this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(e,s,t,i,l){"use strict";const r={INIT:"init",ADDED:"added",LOADING:"loading",PENDING:"pending",UPLOADING:"uploading",COMPLETE:"complete",LOAD_FAILED:"load-failed",UPLOAD_FAILED:"upload-failed"};const a={CLIENT:"client",SERVER:"server"};const o={ADD:"onAdd",BEFORE_UPLOAD:"onBeforeUpload",UPLOAD_START:"onUploadStart",UPLOAD_ERROR:"onUploadError",UPLOAD_PROGRESS:"onUploadProgress",UPLOAD_COMPLETE:"onUploadComplete",UPLOAD_CONTROLLER_INIT:"onUploadControllerInit",LOAD_START:"onLoadStart",LOAD_PROGRESS:"onLoadProgress",LOAD_COMPLETE:"onLoadComplete",LOAD_ERROR:"onLoadError",LOAD_CONTROLLER_INIT:"onLoadControllerInit",REMOVE_ERROR:"onRemoveError",REMOVE_COMPLETE:"onRemoveComplete",REMOVE_CONTROLLER_INIT:"onRemoveControllerInit",STATE_CHANGE:"onStateChange",STATUS_CHANGE:"onStatusChange",PREPARE_FILE_ASYNC:"onPrepareFileAsync"};class n extends l.BaseError{constructor(e,...s){let t=l.Type.isString(s[0])?s[0]:null;let i=l.Type.isString(s[1])?s[1]:null;const r=l.Type.isPlainObject(s[s.length-1])?s[s.length-1]:{};const a={};Object.keys(r).forEach((e=>{a[`#${e}#`]=r[e]}));if(!l.Type.isString(t)&&l.Loc.hasMessage(`UPLOADER_${e}`)){t=l.Loc.getMessage(`UPLOADER_${e}`,a)}if(l.Type.isStringFilled(t)&&!l.Type.isString(i)&&l.Loc.hasMessage(`UPLOADER_${e}_DESC`)){i=l.Loc.getMessage(`UPLOADER_${e}_DESC`,a)}super(t,e,r);this.description="";this.origin=n.Origin.CLIENT;this.type=n.Type.USER;this.setDescription(i)}static createFromAjaxErrors(e){if(!l.Type.isArrayFilled(e)||!l.Type.isPlainObject(e[0])){return new this("SERVER_ERROR")}const s=e.find((e=>e.type==="file-uploader"));if(s&&!s.system){const{code:e,message:t,description:i,customData:l}=s;const r=new this(e,t,i,l);r.setOrigin(n.Origin.SERVER);r.setType(n.Type.USER);return r}else{let{code:s,message:t,description:i}=e[0];const{customData:r,system:a,type:o}=e[0];if(s==="NETWORK_ERROR"){t=l.Loc.getMessage("UPLOADER_NETWORK_ERROR")}else{s=l.Type.isStringFilled(s)?s:"SERVER_ERROR";if(!l.Type.isStringFilled(i)){i=t;t=l.Loc.getMessage("UPLOADER_SERVER_ERROR")}}console.error("Uploader",e);const c=new this(s,t,i,r);c.setOrigin(n.Origin.SERVER);if(o==="file-uploader"){c.setType(a?n.Type.SYSTEM:n.Type.USER)}else{c.setType(n.Type.UNKNOWN)}return c}}static createFromError(e){return new this(e.name,e.message)}getDescription(){return this.description}setDescription(e){if(l.Type.isString(e)){this.description=e}return this}getOrigin(){return this.origin}setOrigin(e){if(Object.values(n.Origin).includes(e)){this.origin=e}return this}getType(){return this.type}setType(e){if(l.Type.isStringFilled(e)){this.type=e}return this}clone(){const e=JSON.parse(JSON.stringify(this));const s=new n(e.code,e.message,e.description,e.customData);s.setOrigin(e.origin);s.setType(e.type);return s}toString(){return`Uploader Error (${this.getCode()}): ${this.getMessage()} (${this.getOrigin()})`}toJSON(){return{code:this.getCode(),message:this.getMessage(),description:this.getDescription(),origin:this.getOrigin(),type:this.getType(),customData:this.getCustomData()}}}n.Origin={SERVER:"server",CLIENT:"client"};n.Type={USER:"user",SYSTEM:"system",UNKNOWN:"unknown"};var c=babelHelpers.classPrivateFieldLooseKey("server");var d=babelHelpers.classPrivateFieldLooseKey("options");class b extends s.EventEmitter{constructor(e,s={}){super();Object.defineProperty(this,c,{writable:true,value:void 0});Object.defineProperty(this,d,{writable:true,value:void 0});this.setEventNamespace("BX.UI.Uploader.UploadController");babelHelpers.classPrivateFieldLooseBase(this,c)[c]=e;babelHelpers.classPrivateFieldLooseBase(this,d)[d]=s}getServer(){return babelHelpers.classPrivateFieldLooseBase(this,c)[c]}getOptions(){return babelHelpers.classPrivateFieldLooseBase(this,d)[d]}getOption(e,s){if(!l.Type.isUndefined(babelHelpers.classPrivateFieldLooseBase(this,d)[d][e])){return babelHelpers.classPrivateFieldLooseBase(this,d)[d][e]}else if(!l.Type.isUndefined(s)){return s}return null}upload(e){throw new Error("You must implement upload() method.")}abort(){throw new Error("You must implement abort() method.")}}var p=babelHelpers.classPrivateFieldLooseKey("server");var h=babelHelpers.classPrivateFieldLooseKey("options");class u extends s.EventEmitter{constructor(e,s={}){super();Object.defineProperty(this,p,{writable:true,value:void 0});Object.defineProperty(this,h,{writable:true,value:void 0});this.setEventNamespace("BX.UI.Uploader.LoadController");babelHelpers.classPrivateFieldLooseBase(this,p)[p]=e;babelHelpers.classPrivateFieldLooseBase(this,h)[h]=s}getServer(){return babelHelpers.classPrivateFieldLooseBase(this,p)[p]}getOptions(){return babelHelpers.classPrivateFieldLooseBase(this,h)[h]}getOption(e,s){if(!l.Type.isUndefined(babelHelpers.classPrivateFieldLooseBase(this,h)[h][e])){return babelHelpers.classPrivateFieldLooseBase(this,h)[h][e]}else if(!l.Type.isUndefined(s)){return s}return null}load(e){throw new Error("You must implement load() method.")}abort(){throw new Error("You must implement abort() method.")}}var v=babelHelpers.classPrivateFieldLooseKey("server");var g=babelHelpers.classPrivateFieldLooseKey("options");class P extends s.EventEmitter{constructor(e,s={}){super();Object.defineProperty(this,v,{writable:true,value:void 0});Object.defineProperty(this,g,{writable:true,value:void 0});this.setEventNamespace("BX.UI.Uploader.RemoveController");babelHelpers.classPrivateFieldLooseBase(this,v)[v]=e;babelHelpers.classPrivateFieldLooseBase(this,g)[g]=s}getServer(){return babelHelpers.classPrivateFieldLooseBase(this,v)[v]}getOptions(){return babelHelpers.classPrivateFieldLooseBase(this,g)[g]}getOption(e,s){if(!Type.isUndefined(babelHelpers.classPrivateFieldLooseBase(this,g)[g][e])){return babelHelpers.classPrivateFieldLooseBase(this,g)[g][e]}else if(!Type.isUndefined(s)){return s}return null}remove(e){throw new Error("You must implement remove() method.")}}let F=window.crypto||window.msCrypto;if(!F&&typeof process==="object"){F=require("crypto").webcrypto}const f=()=>`${1e7}-${1e3}-${4e3}-${8e3}-${1e11}`.replace(/[018]/g,(e=>(e^F.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));const L=e=>{if(!l.Type.isStringFilled(e)){return""}const s=e.split("/").pop();if(/javascript/.test(s)){return"js"}if(/plain/.test(s)){return"txt"}if(/svg/.test(s)){return"svg"}if(/[a-z]+/.test(s)){return s}return""};let y=0;const m=(e,s)=>{if(!l.Type.isStringFilled(s)){const t=new Date;s=`File ${t.getFullYear()}-${t.getMonth()}-${t.getDate()}-${++y}`;const i=L(e.type);if(i){s+=`.${i}`}}try{return new File([e],s,{lastModified:Date.now(),lastModifiedDate:new Date,type:e.type})}catch(t){const i=e.slice(0,e.size,e.type);i.name=s;i.lastModified=Date.now();i.lastModifiedDate=new Date;return i}};const H=/^data:((?:\w+\/(?:(?!;).)+)?)((?:;[\w\W]*?[^;])*),(.+)$/;const E=e=>typeof e==="string"?e.match(H):false;const B=e=>{const s=atob(e.split(",")[1]);const t=e.split(",")[0].split(":")[1].split(";")[0];const i=new ArrayBuffer(s.length);const l=new Uint8Array(i);for(let e=0;e<s.length;e++){l[e]=s.charCodeAt(e)}return new Blob([i],{type:t})};const O=e=>{const s=l.Type.isStringFilled(e)?e.lastIndexOf("."):-1;return s>0?e.substring(s+1):""};const w=["jpg","bmp","jpeg","jpe","gif","png","webp"];const T=(e,s=null)=>{const t=l.Type.isFile(e)?e.name:e;const i=l.Type.isFile(e)?e.type:s;const r=O(t).toLowerCase();if(w.includes(r)){if(i===null||/^image\/[a-z0-9.-]+$/i.test(i)){return true}}return false};const S=(e,s=1024)=>{let t=0;const i=I();while(e>=s&&i[t+1]){e/=s;t++}return(l.Type.isInteger(e)?e:e.toFixed(1))+i[t]};let A=null;const I=()=>{if(A!==null){return A}const e=l.Loc.getMessage("UPLOADER_FILE_SIZE_POSTFIXES").split(/[|]/);A=l.Type.isArrayFilled(e)?e:["B","kB","MB","GB","TB"];return A};var R=babelHelpers.classPrivateFieldLooseKey("id");var U=babelHelpers.classPrivateFieldLooseKey("file");var C=babelHelpers.classPrivateFieldLooseKey("serverId");var D=babelHelpers.classPrivateFieldLooseKey("name");var M=babelHelpers.classPrivateFieldLooseKey("originalName");var _=babelHelpers.classPrivateFieldLooseKey("size");var j=babelHelpers.classPrivateFieldLooseKey("type");var N=babelHelpers.classPrivateFieldLooseKey("width");var z=babelHelpers.classPrivateFieldLooseKey("height");var K=babelHelpers.classPrivateFieldLooseKey("clientPreview");var x=babelHelpers.classPrivateFieldLooseKey("clientPreviewUrl");var k=babelHelpers.classPrivateFieldLooseKey("clientPreviewWidth");var G=babelHelpers.classPrivateFieldLooseKey("clientPreviewHeight");var W=babelHelpers.classPrivateFieldLooseKey("serverPreviewUrl");var V=babelHelpers.classPrivateFieldLooseKey("serverPreviewWidth");var X=babelHelpers.classPrivateFieldLooseKey("serverPreviewHeight");var $=babelHelpers.classPrivateFieldLooseKey("downloadUrl");var J=babelHelpers.classPrivateFieldLooseKey("removeUrl");var Y=babelHelpers.classPrivateFieldLooseKey("status");var Q=babelHelpers.classPrivateFieldLooseKey("origin");var q=babelHelpers.classPrivateFieldLooseKey("errors");var Z=babelHelpers.classPrivateFieldLooseKey("progress");var ee=babelHelpers.classPrivateFieldLooseKey("uploadController");var se=babelHelpers.classPrivateFieldLooseKey("loadController");var te=babelHelpers.classPrivateFieldLooseKey("removeController");var ie=babelHelpers.classPrivateFieldLooseKey("uploadCallbacks");var le=babelHelpers.classPrivateFieldLooseKey("setStatus");class re extends s.EventEmitter{constructor(e,s={}){super();Object.defineProperty(this,le,{value:ae});Object.defineProperty(this,R,{writable:true,value:null});Object.defineProperty(this,U,{writable:true,value:null});Object.defineProperty(this,C,{writable:true,value:null});Object.defineProperty(this,D,{writable:true,value:""});Object.defineProperty(this,M,{writable:true,value:null});Object.defineProperty(this,_,{writable:true,value:0});Object.defineProperty(this,j,{writable:true,value:""});Object.defineProperty(this,N,{writable:true,value:null});Object.defineProperty(this,z,{writable:true,value:null});Object.defineProperty(this,K,{writable:true,value:null});Object.defineProperty(this,x,{writable:true,value:null});Object.defineProperty(this,k,{writable:true,value:null});Object.defineProperty(this,G,{writable:true,value:null});Object.defineProperty(this,W,{writable:true,value:null});Object.defineProperty(this,V,{writable:true,value:null});Object.defineProperty(this,X,{writable:true,value:null});Object.defineProperty(this,$,{writable:true,value:null});Object.defineProperty(this,J,{writable:true,value:null});Object.defineProperty(this,Y,{writable:true,value:r.INIT});Object.defineProperty(this,Q,{writable:true,value:a.CLIENT});Object.defineProperty(this,q,{writable:true,value:[]});Object.defineProperty(this,Z,{writable:true,value:0});Object.defineProperty(this,ee,{writable:true,value:null});Object.defineProperty(this,se,{writable:true,value:null});Object.defineProperty(this,te,{writable:true,value:null});Object.defineProperty(this,ie,{writable:true,value:new ne(this)});this.setEventNamespace("BX.UI.Uploader.File");const t=l.Type.isPlainObject(s)?s:{};if(l.Type.isFile(e)){babelHelpers.classPrivateFieldLooseBase(this,U)[U]=e}else if(l.Type.isBlob(e)){babelHelpers.classPrivateFieldLooseBase(this,U)[U]=m(e,t.name||e.name)}else if(E(e)){const s=B(e);babelHelpers.classPrivateFieldLooseBase(this,U)[U]=m(s,t.name)}else if(l.Type.isNumber(e)||l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,Q)[Q]=a.SERVER;babelHelpers.classPrivateFieldLooseBase(this,C)[C]=e;if(l.Type.isPlainObject(t)){this.setFile(t)}}babelHelpers.classPrivateFieldLooseBase(this,R)[R]=l.Type.isStringFilled(t.id)?t.id:f();this.subscribeFromOptions({[o.ADD]:()=>{babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.ADDED)}});this.subscribeFromOptions(t.events)}load(){if(!this.canLoad()){return}babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.LOADING);this.emit(o.LOAD_START);babelHelpers.classPrivateFieldLooseBase(this,se)[se].load(this)}upload(e={}){babelHelpers.classPrivateFieldLooseBase(this,ie)[ie].subscribe(e);if(this.isComplete()&&this.isUploadable()){return babelHelpers.classPrivateFieldLooseBase(this,ie)[ie].emit("onComplete")}else if(this.isUploadFailed()){return babelHelpers.classPrivateFieldLooseBase(this,ie)[ie].emit("onError",{error:this.getError()})}else if(!this.canUpload()){return babelHelpers.classPrivateFieldLooseBase(this,ie)[ie].emit("onError",{error:new n("FILE_UPLOAD_NOT_ALLOWED")})}const t=new s.BaseEvent({data:{file:this}});this.emit(o.BEFORE_UPLOAD,t);if(t.isDefaultPrevented()){return}babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.UPLOADING);this.emit(o.UPLOAD_START);babelHelpers.classPrivateFieldLooseBase(this,ee)[ee].upload(this)}remove(){if(this.getStatus()===r.INIT){return}babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.INIT);this.emit(o.REMOVE_COMPLETE);this.abort();if(babelHelpers.classPrivateFieldLooseBase(this,te)[te]!==null&&this.getOrigin()===a.CLIENT){babelHelpers.classPrivateFieldLooseBase(this,te)[te].remove(this)}babelHelpers.classPrivateFieldLooseBase(this,ee)[ee]=null;babelHelpers.classPrivateFieldLooseBase(this,se)[se]=null;babelHelpers.classPrivateFieldLooseBase(this,te)[te]=null}abort(){if(this.isLoading()){babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.LOAD_FAILED);const e=new n("FILE_LOAD_ABORTED");this.emit(o.LOAD_ERROR,{error:e})}else if(this.isUploading()){babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.UPLOAD_FAILED);const e=new n("FILE_UPLOAD_ABORTED");this.emit("onUploadError",{error:e});babelHelpers.classPrivateFieldLooseBase(this,ie)[ie].emit("onError",{error:e})}if(babelHelpers.classPrivateFieldLooseBase(this,se)[se]){babelHelpers.classPrivateFieldLooseBase(this,se)[se].abort()}if(babelHelpers.classPrivateFieldLooseBase(this,ee)[ee]){babelHelpers.classPrivateFieldLooseBase(this,ee)[ee].abort()}}getUploadController(){return babelHelpers.classPrivateFieldLooseBase(this,ee)[ee]}setUploadController(e){if(this.getOrigin()===a.SERVER){return}if(!(e instanceof b)&&!l.Type.isNull(e)){return}const s=babelHelpers.classPrivateFieldLooseBase(this,ee)[ee]!==e;babelHelpers.classPrivateFieldLooseBase(this,ee)[ee]=e;if(babelHelpers.classPrivateFieldLooseBase(this,ee)[ee]&&s){babelHelpers.classPrivateFieldLooseBase(this,ee)[ee].subscribeOnce("onError",(e=>{const s=this.addError(e.getData().error);babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.UPLOAD_FAILED);this.emit(o.UPLOAD_ERROR,{error:s});babelHelpers.classPrivateFieldLooseBase(this,ie)[ie].emit("onError",{error:s})}));babelHelpers.classPrivateFieldLooseBase(this,ee)[ee].subscribe("onProgress",(e=>{const{progress:s}=e.getData();this.setProgress(s);this.emit(o.UPLOAD_PROGRESS,{progress:s})}));babelHelpers.classPrivateFieldLooseBase(this,ee)[ee].subscribeOnce("onUpload",(e=>{babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.COMPLETE);this.setFile(e.getData().fileInfo);this.emit(o.UPLOAD_COMPLETE);babelHelpers.classPrivateFieldLooseBase(this,ie)[ie].emit("onComplete")}))}if(s){this.emit(o.UPLOAD_CONTROLLER_INIT,{controller:e})}}setLoadController(e){if(!(e instanceof u)){return}const t=babelHelpers.classPrivateFieldLooseBase(this,se)[se]!==e;babelHelpers.classPrivateFieldLooseBase(this,se)[se]=e;if(babelHelpers.classPrivateFieldLooseBase(this,se)[se]&&t){babelHelpers.classPrivateFieldLooseBase(this,se)[se].subscribeOnce("onError",(e=>{const s=this.addError(e.getData().error);babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.LOAD_FAILED);this.emit(o.LOAD_ERROR,{error:s})}));babelHelpers.classPrivateFieldLooseBase(this,se)[se].subscribe("onProgress",(e=>{const{progress:s}=e.getData();this.emit(o.LOAD_PROGRESS,{progress:s})}));babelHelpers.classPrivateFieldLooseBase(this,se)[se].subscribeOnce("onLoad",(e=>{if(this.getOrigin()===a.SERVER){this.setFile(e.getData().fileInfo);babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.COMPLETE);this.emit(o.LOAD_COMPLETE)}else{const e=new s.BaseEvent({data:{file:this}});this.emitAsync(o.PREPARE_FILE_ASYNC,e).then((()=>{if(this.isUploadable()){babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.PENDING)}else{babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.COMPLETE)}this.emit(o.LOAD_COMPLETE)})).catch((e=>{e=this.addError(e);babelHelpers.classPrivateFieldLooseBase(this,le)[le](r.LOAD_FAILED);this.emit(o.LOAD_ERROR,{error:e})}))}}))}if(t){this.emit(o.LOAD_CONTROLLER_INIT,{controller:e})}}setRemoveController(e){if(!(e instanceof P)&&!l.Type.isNull(e)){return}const s=babelHelpers.classPrivateFieldLooseBase(this,te)[te]!==e;babelHelpers.classPrivateFieldLooseBase(this,te)[te]=e;if(babelHelpers.classPrivateFieldLooseBase(this,te)[te]&&s){babelHelpers.classPrivateFieldLooseBase(this,te)[te].subscribeOnce("onError",(e=>{}));babelHelpers.classPrivateFieldLooseBase(this,te)[te].subscribeOnce("onRemove",(e=>{}))}if(s){this.emit(o.REMOVE_CONTROLLER_INIT,{controller:e})}}isReadyToUpload(){return this.getStatus()===r.PENDING}isUploadable(){return babelHelpers.classPrivateFieldLooseBase(this,ee)[ee]!==null}isLoadable(){return babelHelpers.classPrivateFieldLooseBase(this,se)[se]!==null}canUpload(){return this.isReadyToUpload()&&this.isUploadable()}canLoad(){return this.getStatus()===r.ADDED&&this.isLoadable()}isUploading(){return this.getStatus()===r.UPLOADING}isLoading(){return this.getStatus()===r.LOADING}isComplete(){return this.getStatus()===r.COMPLETE}isFailed(){return this.getStatus()===r.LOAD_FAILED||this.getStatus()===r.UPLOAD_FAILED}isLoadFailed(){return this.getStatus()===r.LOAD_FAILED}isUploadFailed(){return this.getStatus()===r.UPLOAD_FAILED}getBinary(){return babelHelpers.classPrivateFieldLooseBase(this,U)[U]}setFile(e){if(l.Type.isFile(e)){babelHelpers.classPrivateFieldLooseBase(this,U)[U]=e}else if(l.Type.isBlob(e)){babelHelpers.classPrivateFieldLooseBase(this,U)[U]=m(e,this.getName())}else if(l.Type.isPlainObject(e)){this.setName(e.name);this.setOriginalName(e.originalName);this.setType(e.type);this.setSize(e.size);this.setServerId(e.serverId);this.setWidth(e.width);this.setHeight(e.height);this.setClientPreview(e.clientPreview,e.clientPreviewWidth,e.clientPreviewHeight);this.setServerPreview(e.serverPreviewUrl,e.serverPreviewWidth,e.serverPreviewHeight);this.setDownloadUrl(e.downloadUrl);this.setRemoveUrl(e.removeUrl)}}getName(){return this.getBinary()?this.getBinary().name:babelHelpers.classPrivateFieldLooseBase(this,D)[D]}setName(e){if(l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,D)[D]=e;this.emit(o.STATE_CHANGE,{property:"name",value:e})}}getOriginalName(){return babelHelpers.classPrivateFieldLooseBase(this,M)[M]?babelHelpers.classPrivateFieldLooseBase(this,M)[M]:this.getName()}setOriginalName(e){if(l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,M)[M]=e;this.emit(o.STATE_CHANGE,{property:"originalName",value:e})}}getExtension(){const e=this.getOriginalName();const s=e.lastIndexOf(".");return s>=0?e.substring(s+1).toLowerCase():""}getType(){return this.getBinary()?this.getBinary().type:babelHelpers.classPrivateFieldLooseBase(this,j)[j]}setType(e){if(l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,j)[j]=e;this.emit(o.STATE_CHANGE,{property:"type",value:e})}}getSize(){return this.getBinary()?this.getBinary().size:babelHelpers.classPrivateFieldLooseBase(this,_)[_]}getSizeFormatted(){return S(this.getSize())}setSize(e){if(l.Type.isNumber(e)&&e>=0){babelHelpers.classPrivateFieldLooseBase(this,_)[_]=e;this.emit(o.STATE_CHANGE,{property:"size",value:e})}}getId(){return babelHelpers.classPrivateFieldLooseBase(this,R)[R]}getServerId(){return babelHelpers.classPrivateFieldLooseBase(this,C)[C]}setServerId(e){if(l.Type.isNumber(e)||l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,C)[C]=e;this.emit(o.STATE_CHANGE,{property:"serverId",value:e})}}getStatus(){return babelHelpers.classPrivateFieldLooseBase(this,Y)[Y]}getOrigin(){return babelHelpers.classPrivateFieldLooseBase(this,Q)[Q]}getDownloadUrl(){return babelHelpers.classPrivateFieldLooseBase(this,$)[$]}setDownloadUrl(e){if(l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,$)[$]=e;this.emit(o.STATE_CHANGE,{property:"downloadUrl",value:e})}}getRemoveUrl(){return babelHelpers.classPrivateFieldLooseBase(this,J)[J]}setRemoveUrl(e){if(l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,J)[J]=e;this.emit(o.STATE_CHANGE,{property:"removeUrl",value:e})}}getWidth(){return babelHelpers.classPrivateFieldLooseBase(this,N)[N]}setWidth(e){if(l.Type.isNumber(e)){babelHelpers.classPrivateFieldLooseBase(this,N)[N]=e;this.emit(o.STATE_CHANGE,{property:"width",value:e})}}getHeight(){return babelHelpers.classPrivateFieldLooseBase(this,z)[z]}setHeight(e){if(l.Type.isNumber(e)){babelHelpers.classPrivateFieldLooseBase(this,z)[z]=e;this.emit(o.STATE_CHANGE,{property:"height",value:e})}}getPreviewUrl(){return this.getClientPreview()?this.getClientPreviewUrl():this.getServerPreviewUrl()}getPreviewWidth(){return this.getClientPreview()?this.getClientPreviewWidth():this.getServerPreviewWidth()}getPreviewHeight(){return this.getClientPreview()?this.getClientPreviewHeight():this.getServerPreviewHeight()}getClientPreview(){return babelHelpers.classPrivateFieldLooseBase(this,K)[K]}setClientPreview(e,s=null,t=null){if(l.Type.isBlob(e)||l.Type.isNull(e)){this.revokeClientPreviewUrl();const i=l.Type.isNull(e)?null:URL.createObjectURL(e);babelHelpers.classPrivateFieldLooseBase(this,K)[K]=e;babelHelpers.classPrivateFieldLooseBase(this,x)[x]=i;babelHelpers.classPrivateFieldLooseBase(this,k)[k]=s;babelHelpers.classPrivateFieldLooseBase(this,G)[G]=t;this.emit(o.STATE_CHANGE,{property:"clientPreviewUrl",value:i});this.emit(o.STATE_CHANGE,{property:"clientPreviewWidth",value:s});this.emit(o.STATE_CHANGE,{property:"clientPreviewHeight",value:t})}}getClientPreviewUrl(){return babelHelpers.classPrivateFieldLooseBase(this,x)[x]}revokeClientPreviewUrl(){if(babelHelpers.classPrivateFieldLooseBase(this,x)[x]!==null){URL.revokeObjectURL(babelHelpers.classPrivateFieldLooseBase(this,x)[x]);babelHelpers.classPrivateFieldLooseBase(this,x)[x]=null;this.emit(o.STATE_CHANGE,{property:"clientPreviewUrl",value:null})}}getClientPreviewWidth(){return babelHelpers.classPrivateFieldLooseBase(this,k)[k]}getClientPreviewHeight(){return babelHelpers.classPrivateFieldLooseBase(this,G)[G]}getServerPreviewUrl(){return babelHelpers.classPrivateFieldLooseBase(this,W)[W]}setServerPreview(e,s=null,t=null){if(l.Type.isStringFilled(e)||l.Type.isNull(e)){babelHelpers.classPrivateFieldLooseBase(this,W)[W]=e;babelHelpers.classPrivateFieldLooseBase(this,V)[V]=s;babelHelpers.classPrivateFieldLooseBase(this,X)[X]=t;this.emit(o.STATE_CHANGE,{property:"serverPreviewUrl",value:e});this.emit(o.STATE_CHANGE,{property:"serverPreviewWidth",value:s});this.emit(o.STATE_CHANGE,{property:"serverPreviewHeight",value:t})}}getServerPreviewWidth(){return babelHelpers.classPrivateFieldLooseBase(this,V)[V]}getServerPreviewHeight(){return babelHelpers.classPrivateFieldLooseBase(this,X)[X]}isImage(){return T(this.getOriginalName(),this.getType())}getProgress(){return babelHelpers.classPrivateFieldLooseBase(this,Z)[Z]}setProgress(e){if(l.Type.isNumber(e)){babelHelpers.classPrivateFieldLooseBase(this,Z)[Z]=e;this.emit(o.STATE_CHANGE,{property:"progress",value:e})}}addError(e){if(e instanceof Error){e=n.createFromError(e)}babelHelpers.classPrivateFieldLooseBase(this,q)[q].push(e);this.emit(o.STATE_CHANGE);return e}getError(){return babelHelpers.classPrivateFieldLooseBase(this,q)[q][0]||null}getErrors(){return babelHelpers.classPrivateFieldLooseBase(this,q)[q]}getState(){return JSON.parse(JSON.stringify(this))}toJSON(){return{id:this.getId(),serverId:this.getServerId(),status:this.getStatus(),name:this.getName(),originalName:this.getOriginalName(),size:this.getSize(),sizeFormatted:this.getSizeFormatted(),type:this.getType(),extension:this.getExtension(),origin:this.getOrigin(),isImage:this.isImage(),failed:this.isFailed(),width:this.getWidth(),height:this.getHeight(),progress:this.getProgress(),error:this.getError(),errors:this.getErrors(),previewUrl:this.getPreviewUrl(),previewWidth:this.getPreviewWidth(),previewHeight:this.getPreviewHeight(),clientPreviewUrl:this.getClientPreviewUrl(),clientPreviewWidth:this.getClientPreviewWidth(),clientPreviewHeight:this.getClientPreviewHeight(),serverPreviewUrl:this.getServerPreviewUrl(),serverPreviewWidth:this.getServerPreviewWidth(),serverPreviewHeight:this.getServerPreviewHeight(),downloadUrl:this.getDownloadUrl(),removeUrl:this.getRemoveUrl()}}}function ae(e){babelHelpers.classPrivateFieldLooseBase(this,Y)[Y]=e;this.emit(o.STATE_CHANGE,{property:"status",value:e});this.emit(o.STATUS_CHANGE)}var oe=babelHelpers.classPrivateFieldLooseKey("emitter");class ne{constructor(e){Object.defineProperty(this,oe,{writable:true,value:null});babelHelpers.classPrivateFieldLooseBase(this,oe)[oe]=new s.EventEmitter(e,"BX.UI.Uploader.File.UploadCallbacks")}subscribe(e={}){e=l.Type.isPlainObject(e)?e:{};if(l.Type.isFunction(e.onComplete)){this.getEmitter().subscribeOnce("onComplete",e.onComplete)}if(l.Type.isFunction(e.onError)){this.getEmitter().subscribeOnce("onError",e.onError)}}emit(e,s){if(babelHelpers.classPrivateFieldLooseBase(this,oe)[oe]){babelHelpers.classPrivateFieldLooseBase(this,oe)[oe].emit(e,s);babelHelpers.classPrivateFieldLooseBase(this,oe)[oe].unsubscribeAll()}}getEmitter(){if(l.Type.isNull(babelHelpers.classPrivateFieldLooseBase(this,oe)[oe])){babelHelpers.classPrivateFieldLooseBase(this,oe)[oe]=new s.EventEmitter(this,"BX.UI.Uploader.File.UploadCallbacks")}return babelHelpers.classPrivateFieldLooseBase(this,oe)[oe]}}var ce=babelHelpers.classPrivateFieldLooseKey("data");var de=babelHelpers.classPrivateFieldLooseKey("offset");var be=babelHelpers.classPrivateFieldLooseKey("retries");class pe{constructor(e,s){Object.defineProperty(this,ce,{writable:true,value:null});Object.defineProperty(this,de,{writable:true,value:0});Object.defineProperty(this,be,{writable:true,value:[]});babelHelpers.classPrivateFieldLooseBase(this,ce)[ce]=e;babelHelpers.classPrivateFieldLooseBase(this,de)[de]=s}getNextRetryDelay(){if(babelHelpers.classPrivateFieldLooseBase(this,be)[be].length===0){return null}return babelHelpers.classPrivateFieldLooseBase(this,be)[be].shift()}setRetries(e){if(l.Type.isArray(e)){babelHelpers.classPrivateFieldLooseBase(this,be)[be]=e}}getData(){return babelHelpers.classPrivateFieldLooseBase(this,ce)[ce]}getOffset(){return babelHelpers.classPrivateFieldLooseBase(this,de)[de]}getSize(){return this.getData().size}}var he=babelHelpers.classPrivateFieldLooseKey("file");var ue=babelHelpers.classPrivateFieldLooseKey("chunkOffset");var ve=babelHelpers.classPrivateFieldLooseKey("chunkTimeout");var ge=babelHelpers.classPrivateFieldLooseKey("token");var Pe=babelHelpers.classPrivateFieldLooseKey("xhr");var Fe=babelHelpers.classPrivateFieldLooseKey("aborted");var fe=babelHelpers.classPrivateFieldLooseKey("uploadChunk");var Le=babelHelpers.classPrivateFieldLooseKey("retryUploadChunk");var ye=babelHelpers.classPrivateFieldLooseKey("getNextChunk");class me extends b{constructor(e,s={}){super(e,s);Object.defineProperty(this,ye,{value:Be});Object.defineProperty(this,Le,{value:Ee});Object.defineProperty(this,fe,{value:He});Object.defineProperty(this,he,{writable:true,value:null});Object.defineProperty(this,ue,{writable:true,value:null});Object.defineProperty(this,ve,{writable:true,value:null});Object.defineProperty(this,ge,{writable:true,value:null});Object.defineProperty(this,Pe,{writable:true,value:null});Object.defineProperty(this,Fe,{writable:true,value:false})}upload(e){if(babelHelpers.classPrivateFieldLooseBase(this,ue)[ue]!==null){return}babelHelpers.classPrivateFieldLooseBase(this,he)[he]=e;const s=babelHelpers.classPrivateFieldLooseBase(this,ye)[ye]();if(s){babelHelpers.classPrivateFieldLooseBase(this,fe)[fe](s)}}abort(){if(babelHelpers.classPrivateFieldLooseBase(this,Pe)[Pe]){babelHelpers.classPrivateFieldLooseBase(this,Fe)[Fe]=true;babelHelpers.classPrivateFieldLooseBase(this,Pe)[Pe].abort();babelHelpers.classPrivateFieldLooseBase(this,Pe)[Pe]=null}clearTimeout(babelHelpers.classPrivateFieldLooseBase(this,ve)[ve])}getFile(){return babelHelpers.classPrivateFieldLooseBase(this,he)[he]}getChunkSize(){return this.getServer().getChunkSize()}getChunkOffset(){return babelHelpers.classPrivateFieldLooseBase(this,ue)[ue]}getToken(){return babelHelpers.classPrivateFieldLooseBase(this,ge)[ge]}setToken(e){if(l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,ge)[ge]=e}}}function He(e){const s=this.getFile().getSize();const t=e.getOffset()===0&&s===e.getSize();let i=this.getFile().getName();if(i.normalize){i=i.normalize()}const r=l.Type.isStringFilled(this.getFile().getType())?this.getFile().getType():"application/octet-stream";const a=[{name:"Content-Type",value:r},{name:"X-Upload-Content-Name",value:encodeURIComponent(i)}];if(!t){const t=e.getOffset();const i=e.getOffset()+e.getSize()-1;const l=`bytes ${t}-${i}/${s}`;a.push({name:"Content-Range",value:l})}const o=this.getServer().getControllerOptions();l.ajax.runAction("ui.fileuploader.upload",{headers:a,data:e.getData(),preparePost:false,getParameters:{controller:this.getServer().getController(),controllerOptions:o?JSON.stringify(o):null,token:this.getToken()||""},onrequeststart:e=>{babelHelpers.classPrivateFieldLooseBase(this,Pe)[Pe]=e;babelHelpers.classPrivateFieldLooseBase(this,Fe)[Fe]=false},onprogressupload:s=>{if(s.lengthComputable){const t=this.getFile().getSize();const i=Math.min(t,e.getOffset()+s.loaded);const l=t>0?Math.floor(i/t*100):100;this.emit("onProgress",{progress:l})}}}).then((s=>{if(s.data.token){this.setToken(s.data.token);if(this.getFile().getServerId()===null){this.getFile().setServerId(s.data.token)}const t=this.getFile().getSize();const i=t>0?Math.floor((e.getOffset()+e.getSize())/t*100):100;this.emit("onProgress",{progress:i});const l=babelHelpers.classPrivateFieldLooseBase(this,ye)[ye]();if(l){babelHelpers.classPrivateFieldLooseBase(this,fe)[fe](l)}else{this.emit("onProgress",{progress:100});this.emit("onUpload",{fileInfo:s.data.file})}}else{this.emit("onError",{error:new n("SERVER_ERROR")})}})).catch((s=>{if(babelHelpers.classPrivateFieldLooseBase(this,Fe)[Fe]){return}const t=n.createFromAjaxErrors(s.errors);const i=t.getCode()==="NETWORK_ERROR"||t.getType()===n.Type.UNKNOWN;if(!i||!babelHelpers.classPrivateFieldLooseBase(this,Le)[Le](e)){this.emit("onError",{error:t})}}))}function Ee(e){const s=e.getNextRetryDelay();if(s===null){return false}clearTimeout(babelHelpers.classPrivateFieldLooseBase(this,ve)[ve]);babelHelpers.classPrivateFieldLooseBase(this,ve)[ve]=setTimeout((()=>{babelHelpers.classPrivateFieldLooseBase(this,fe)[fe](e)}),s);return true}function Be(){if(this.getChunkOffset()!==null&&this.getChunkOffset()>=this.getFile().getSize()){return null}if(this.getChunkOffset()===null){babelHelpers.classPrivateFieldLooseBase(this,ue)[ue]=0}let e;if(this.getChunkOffset()===0&&this.getFile().getSize()<=this.getChunkSize()){e=new pe(this.getFile().getBinary(),this.getChunkOffset());babelHelpers.classPrivateFieldLooseBase(this,ue)[ue]=this.getFile().getSize()}else{const s=Math.min(this.getChunkSize(),this.getFile().getSize()-this.getChunkOffset());const t=this.getChunkOffset()+s;const i=this.getFile().getBinary().slice(this.getChunkOffset(),t);e=new pe(i,this.getChunkOffset());babelHelpers.classPrivateFieldLooseBase(this,ue)[ue]=t}e.setRetries([...this.getServer().getChunkRetryDelays()]);return e}const Oe=new WeakMap;const we=new WeakMap;function Te(e,s){const t=e.getServer();const i=e.getOption("timeout",100);let r=Oe.get(t);if(!r){r={tasks:[],load:l.Runtime.debounce(Ae,i,t),xhr:null,aborted:false};Oe.set(t,r)}r.tasks.push({controller:e,file:s});r.load()}function Se(e,s){const t=e.getServer();const i=Oe.get(t);if(i){i.tasks=i.tasks.filter((e=>e.file!==s));if(i.tasks.length===0){Oe.delete(t)}}else{const e=we.get(s);if(e){e.tasks=e.tasks.filter((e=>e.file!==s));we.delete(s);if(e.tasks.length===0){e.aborted=true;e.xhr.abort()}}}}function Ae(){const e=this;const s=Oe.get(e);if(!s){return}Oe.delete(e);if(s.tasks.length===0){return}const t=[];s.tasks.forEach((e=>{const i=e.file;t.push(i.getServerId());we.set(i,s)}));const i=e.getControllerOptions();l.ajax.runAction("ui.fileuploader.load",{data:{fileIds:t},getParameters:{controller:e.getController(),controllerOptions:i?JSON.stringify(i):null},onrequeststart:e=>{s.xhr=e},onprogress:e=>{if(e.lengthComputable){const t=e.total>0?Math.floor(e.loaded/e.total*100):100;s.tasks.forEach((e=>{const{controller:s,file:i}=e;s.emit("onProgress",{file:i,progress:t})}))}}}).then((e=>{var t;if((t=e.data)!=null&&t.files){const t={};e.data.files.forEach((e=>{t[e.id]=e}));s.tasks.forEach((e=>{const{controller:s,file:i}=e;const l=t[i.getServerId()]||null;we.delete(i);if(l&&l.success){s.emit("onProgress",{file:i,progress:100});s.emit("onLoad",{fileInfo:l.data.file})}else{const e=n.createFromAjaxErrors(l==null?void 0:l.errors);s.emit("onError",{error:e})}}))}else{const e=new n("SERVER_ERROR");s.tasks.forEach((s=>{const{controller:t,file:i}=s;we.delete(i);t.emit("onError",{error:e.clone()})}))}})).catch((e=>{const t=s.aborted?null:n.createFromAjaxErrors(e.errors);s.tasks.forEach((e=>{const{controller:i,file:l}=e;we.delete(l);if(!s.aborted){i.emit("onError",{error:t.clone()})}}))}))}var Ie=babelHelpers.classPrivateFieldLooseKey("file");class Re extends u{constructor(e,s={}){super(e,s);Object.defineProperty(this,Ie,{writable:true,value:null})}load(e){if(this.getServer().getController()){babelHelpers.classPrivateFieldLooseBase(this,Ie)[Ie]=e;Te(this,e)}else{this.emit("onProgress",{file:e,progress:100});this.emit("onLoad",{fileInfo:null})}}abort(){if(this.getServer().getController()&&babelHelpers.classPrivateFieldLooseBase(this,Ie)[Ie]){Se(this,babelHelpers.classPrivateFieldLooseBase(this,Ie)[Ie])}}}class Ue extends u{constructor(e,s={}){super(e,s)}load(e){if(l.Type.isFile(e.getBinary())){this.emit("onProgress",{file:e,progress:100});this.emit("onLoad",{fileInfo:e})}else{this.emit("onError",{error:new n("WRONG_FILE_SOURCE")})}}abort(){}}const Ce=new WeakMap;function De(e,s){const t=e.getServer();let i=Ce.get(t);if(!i){i={tasks:[],remove:l.Runtime.debounce(Me,1e3,t),xhr:null};Ce.set(t,i)}i.tasks.push({controller:e,file:s});i.remove()}function Me(){const e=this;const s=Ce.get(e);if(!s){return}const{tasks:t}=s;Ce.delete(e);const i=[];t.forEach((e=>{const s=e.file;if(s.getServerId()!==null){i.push(s.getServerId())}}));if(i.length===0){return}const r=e.getControllerOptions();l.ajax.runAction("ui.fileuploader.remove",{data:{fileIds:i},getParameters:{controller:e.getController(),controllerOptions:r?JSON.stringify(r):null},onrequeststart:e=>{s.xhr=e}}).then((e=>{var s;if((s=e.data)!=null&&s.files){const s={};e.data.files.forEach((e=>{s[e.id]=e}));t.forEach((e=>{const{controller:t,file:i}=e;const l=s[i.getServerId()]||null;if(l&&l.success){t.emit("onRemove",{fileId:l.id})}else{const e=n.createFromAjaxErrors(l==null?void 0:l.errors);t.emit("onError",{error:e})}}))}else{const e=new n("SERVER_ERROR");t.forEach((s=>{const{controller:t}=s;t.emit("onError",{error:e.clone()})}))}})).catch((e=>{const s=n.createFromAjaxErrors(e.errors);t.forEach((e=>{const{controller:t}=e;t.emit("onError",{error:s.clone()})}))}))}class _e extends P{constructor(e){super(e)}remove(e){De(this,e)}}var je=babelHelpers.classPrivateFieldLooseKey("controller");var Ne=babelHelpers.classPrivateFieldLooseKey("controllerOptions");var ze=babelHelpers.classPrivateFieldLooseKey("uploadControllerClass");var Ke=babelHelpers.classPrivateFieldLooseKey("uploadControllerOptions");var xe=babelHelpers.classPrivateFieldLooseKey("loadControllerClass");var ke=babelHelpers.classPrivateFieldLooseKey("loadControllerOptions");var Ge=babelHelpers.classPrivateFieldLooseKey("removeControllerClass");var We=babelHelpers.classPrivateFieldLooseKey("removeControllerOptions");var Ve=babelHelpers.classPrivateFieldLooseKey("chunkSize");var Xe=babelHelpers.classPrivateFieldLooseKey("defaultChunkSize");var $e=babelHelpers.classPrivateFieldLooseKey("chunkMinSize");var Je=babelHelpers.classPrivateFieldLooseKey("chunkMaxSize");var Ye=babelHelpers.classPrivateFieldLooseKey("chunkRetryDelays");var Qe=babelHelpers.classPrivateFieldLooseKey("calcChunkSize");class qe{constructor(e){Object.defineProperty(this,Qe,{value:Ze});Object.defineProperty(this,je,{writable:true,value:null});Object.defineProperty(this,Ne,{writable:true,value:null});Object.defineProperty(this,ze,{writable:true,value:null});Object.defineProperty(this,Ke,{writable:true,value:{}});Object.defineProperty(this,xe,{writable:true,value:null});Object.defineProperty(this,ke,{writable:true,value:{}});Object.defineProperty(this,Ge,{writable:true,value:null});Object.defineProperty(this,We,{writable:true,value:{}});Object.defineProperty(this,Ve,{writable:true,value:null});Object.defineProperty(this,Xe,{writable:true,value:null});Object.defineProperty(this,$e,{writable:true,value:null});Object.defineProperty(this,Je,{writable:true,value:null});Object.defineProperty(this,Ye,{writable:true,value:[1e3,3e3,6e3]});const s=l.Type.isPlainObject(e)?e:{};babelHelpers.classPrivateFieldLooseBase(this,je)[je]=l.Type.isStringFilled(s.controller)?s.controller:null;babelHelpers.classPrivateFieldLooseBase(this,Ne)[Ne]=l.Type.isPlainObject(s.controllerOptions)?s.controllerOptions:null;const t=l.Type.isNumber(s.chunkSize)&&s.chunkSize>0?s.chunkSize:this.getDefaultChunkSize();babelHelpers.classPrivateFieldLooseBase(this,Ve)[Ve]=s.forceChunkSize===true?t:babelHelpers.classPrivateFieldLooseBase(this,Qe)[Qe](t);if(s.chunkRetryDelays===false||s.chunkRetryDelays===null){babelHelpers.classPrivateFieldLooseBase(this,Ye)[Ye]=[]}else if(l.Type.isArray(s.chunkRetryDelays)){babelHelpers.classPrivateFieldLooseBase(this,Ye)[Ye]=s.chunkRetryDelays}["uploadControllerClass","loadControllerClass","removeControllerClass"].forEach((e=>{let t=null;if(l.Type.isStringFilled(s[e])){t=l.Runtime.getClass(s[e]);if(!l.Type.isFunction(t)){throw new Error(`Uploader.Server: "${e}" must be a function.`)}}else if(l.Type.isFunction(s[e])){t=s[e]}if(e==="uploadControllerClass"){babelHelpers.classPrivateFieldLooseBase(this,ze)[ze]=t}else if(e==="loadControllerClass"){babelHelpers.classPrivateFieldLooseBase(this,xe)[xe]=t}else if(e==="removeControllerClass"){babelHelpers.classPrivateFieldLooseBase(this,Ge)[Ge]=t}}));babelHelpers.classPrivateFieldLooseBase(this,ke)[ke]=l.Type.isPlainObject(s.loadControllerOptions)?s.loadControllerOptions:{};babelHelpers.classPrivateFieldLooseBase(this,Ke)[Ke]=l.Type.isPlainObject(s.uploadControllerOptions)?s.uploadControllerOptions:{};babelHelpers.classPrivateFieldLooseBase(this,We)[We]=l.Type.isPlainObject(s.removeControllerOptions)?s.removeControllerOptions:{}}createUploadController(){if(babelHelpers.classPrivateFieldLooseBase(this,ze)[ze]){const e=new(babelHelpers.classPrivateFieldLooseBase(this,ze)[ze])(this,babelHelpers.classPrivateFieldLooseBase(this,Ke)[Ke]);if(!(e instanceof b)){throw new Error('Uploader.Server: "uploadControllerClass" must be an instance of AbstractUploadController.')}return e}else if(l.Type.isStringFilled(babelHelpers.classPrivateFieldLooseBase(this,je)[je])){return new me(this,babelHelpers.classPrivateFieldLooseBase(this,Ke)[Ke])}return null}createLoadController(){if(babelHelpers.classPrivateFieldLooseBase(this,xe)[xe]){const e=new(babelHelpers.classPrivateFieldLooseBase(this,xe)[xe])(this,babelHelpers.classPrivateFieldLooseBase(this,ke)[ke]);if(!(e instanceof u)){throw new Error('Uploader.Server: "loadControllerClass" must be an instance of AbstractLoadController.')}return e}return new Re(this,babelHelpers.classPrivateFieldLooseBase(this,ke)[ke])}createClientLoadController(){return new Ue(this,babelHelpers.classPrivateFieldLooseBase(this,ke)[ke])}createRemoveController(){if(babelHelpers.classPrivateFieldLooseBase(this,Ge)[Ge]){const e=new(babelHelpers.classPrivateFieldLooseBase(this,Ge)[Ge])(this,babelHelpers.classPrivateFieldLooseBase(this,We)[We]);if(!(e instanceof P)){throw new Error('Uploader.Server: "removeControllerClass" must be an instance of AbstractRemoveController.')}return e}else if(l.Type.isStringFilled(babelHelpers.classPrivateFieldLooseBase(this,je)[je])){return new _e(this,babelHelpers.classPrivateFieldLooseBase(this,We)[We])}return null}getController(){return babelHelpers.classPrivateFieldLooseBase(this,je)[je]}getControllerOptions(){return babelHelpers.classPrivateFieldLooseBase(this,Ne)[Ne]}getChunkSize(){return babelHelpers.classPrivateFieldLooseBase(this,Ve)[Ve]}getDefaultChunkSize(){if(babelHelpers.classPrivateFieldLooseBase(this,Xe)[Xe]===null){const e=l.Extension.getSettings("ui.uploader.core");babelHelpers.classPrivateFieldLooseBase(this,Xe)[Xe]=e.get("defaultChunkSize",5*1024*1024)}return babelHelpers.classPrivateFieldLooseBase(this,Xe)[Xe]}getChunkMinSize(){if(babelHelpers.classPrivateFieldLooseBase(this,$e)[$e]===null){const e=l.Extension.getSettings("ui.uploader.core");babelHelpers.classPrivateFieldLooseBase(this,$e)[$e]=e.get("chunkMinSize",1024*1024)}return babelHelpers.classPrivateFieldLooseBase(this,$e)[$e]}getChunkMaxSize(){if(babelHelpers.classPrivateFieldLooseBase(this,Je)[Je]===null){const e=l.Extension.getSettings("ui.uploader.core");babelHelpers.classPrivateFieldLooseBase(this,Je)[Je]=e.get("chunkMaxSize",5*1024*1024)}return babelHelpers.classPrivateFieldLooseBase(this,Je)[Je]}getChunkRetryDelays(){return babelHelpers.classPrivateFieldLooseBase(this,Ye)[Ye]}}function Ze(e){return Math.min(Math.max(this.getChunkMinSize(),e),this.getChunkMaxSize())}var es=babelHelpers.classPrivateFieldLooseKey("uploader");class ss{constructor(e,s={}){Object.defineProperty(this,es,{writable:true,value:null});babelHelpers.classPrivateFieldLooseBase(this,es)[es]=e}getUploader(){return babelHelpers.classPrivateFieldLooseBase(this,es)[es]}apply(...e){throw new Error("You must implement apply() method.")}}var ts=babelHelpers.classPrivateFieldLooseKey("maxFileSize");var is=babelHelpers.classPrivateFieldLooseKey("minFileSize");var ls=babelHelpers.classPrivateFieldLooseKey("maxTotalFileSize");var rs=babelHelpers.classPrivateFieldLooseKey("imageMaxFileSize");var as=babelHelpers.classPrivateFieldLooseKey("imageMinFileSize");class os extends ss{constructor(e,s={}){super(e);Object.defineProperty(this,ts,{writable:true,value:256*1024*1024});Object.defineProperty(this,is,{writable:true,value:0});Object.defineProperty(this,ls,{writable:true,value:null});Object.defineProperty(this,rs,{writable:true,value:48*1024*1024});Object.defineProperty(this,as,{writable:true,value:0});const t=l.Extension.getSettings("ui.uploader.core");babelHelpers.classPrivateFieldLooseBase(this,ts)[ts]=t.get("maxFileSize",babelHelpers.classPrivateFieldLooseBase(this,ts)[ts]);babelHelpers.classPrivateFieldLooseBase(this,is)[is]=t.get("minFileSize",babelHelpers.classPrivateFieldLooseBase(this,is)[is]);babelHelpers.classPrivateFieldLooseBase(this,ls)[ls]=t.get("maxTotalFileSize",babelHelpers.classPrivateFieldLooseBase(this,ls)[ls]);babelHelpers.classPrivateFieldLooseBase(this,rs)[rs]=t.get("imageMaxFileSize",babelHelpers.classPrivateFieldLooseBase(this,rs)[rs]);babelHelpers.classPrivateFieldLooseBase(this,as)[as]=t.get("imageMinFileSize",babelHelpers.classPrivateFieldLooseBase(this,as)[as]);const i=l.Type.isPlainObject(s)?s:{};this.setMaxFileSize(i["maxFileSize"]);this.setMinFileSize(i["minFileSize"]);this.setMaxTotalFileSize(i["maxTotalFileSize"]);this.setImageMaxFileSize(i["imageMaxFileSize"]);this.setImageMinFileSize(i["imageMinFileSize"])}apply(e){return new Promise(((s,t)=>{if(this.getMaxFileSize()!==null&&e.getSize()>this.getMaxFileSize()){t(new n("MAX_FILE_SIZE_EXCEEDED",{maxFileSize:S(this.getMaxFileSize()),maxFileSizeInBytes:this.getMaxFileSize()}));return}if(e.getSize()<this.getMinFileSize()){t(new n("MIN_FILE_SIZE_EXCEEDED",{minFileSize:S(this.getMinFileSize()),minFileSizeInBytes:this.getMinFileSize()}));return}if(e.isImage()){if(this.getImageMaxFileSize()!==null&&e.getSize()>this.getImageMaxFileSize()){t(new n("IMAGE_MAX_FILE_SIZE_EXCEEDED",{imageMaxFileSize:S(this.getImageMaxFileSize()),imageMaxFileSizeInBytes:this.getImageMaxFileSize()}));return}if(e.getSize()<this.getImageMinFileSize()){t(new n("IMAGE_MIN_FILE_SIZE_EXCEEDED",{imageMinFileSize:S(this.getImageMinFileSize()),imageMinFileSizeInBytes:this.getImageMinFileSize()}));return}}if(this.getMaxTotalFileSize()!==null){if(this.getUploader().getTotalSize()>this.getMaxTotalFileSize()){t(new n("MAX_TOTAL_FILE_SIZE_EXCEEDED",{maxTotalFileSize:S(this.getMaxTotalFileSize()),maxTotalFileSizeInBytes:this.getMaxTotalFileSize()}));return}}s()}))}getMaxFileSize(){return babelHelpers.classPrivateFieldLooseBase(this,ts)[ts]}setMaxFileSize(e){if(l.Type.isNumber(e)&&e>=0||l.Type.isNull(e)){babelHelpers.classPrivateFieldLooseBase(this,ts)[ts]=e}}getMinFileSize(){return babelHelpers.classPrivateFieldLooseBase(this,is)[is]}setMinFileSize(e){if(l.Type.isNumber(e)&&e>=0){babelHelpers.classPrivateFieldLooseBase(this,is)[is]=e}}getMaxTotalFileSize(){return babelHelpers.classPrivateFieldLooseBase(this,ls)[ls]}setMaxTotalFileSize(e){if(l.Type.isNumber(e)&&e>=0||l.Type.isNull(e)){babelHelpers.classPrivateFieldLooseBase(this,ls)[ls]=e}}getImageMaxFileSize(){return babelHelpers.classPrivateFieldLooseBase(this,rs)[rs]}setImageMaxFileSize(e){if(l.Type.isNumber(e)&&e>=0||l.Type.isNull(e)){babelHelpers.classPrivateFieldLooseBase(this,rs)[rs]=e}}getImageMinFileSize(){return babelHelpers.classPrivateFieldLooseBase(this,as)[as]}setImageMinFileSize(e){if(l.Type.isNumber(e)&&e>=0){babelHelpers.classPrivateFieldLooseBase(this,as)[as]=e}}}const ns=(e,s)=>{if(!l.Type.isArrayFilled(s)){return true}const t=e.type;const i=t.replace(/\/.*$/,"");for(let r=0;r<s.length;r++){if(!l.Type.isStringFilled(s[r])){continue}const a=s[r].trim().toLowerCase();if(a.charAt(0)==="."){if(e.name.toLowerCase().indexOf(a,e.name.length-a.length)!==-1){return true}}else if(/\/\*$/.test(a)){if(i===a.replace(/\/.*$/,"")){return true}}else if(t===a){return true}}return false};class cs extends ss{constructor(e,s={}){super(e)}apply(e){return new Promise(((s,t)=>{if(ns(e.getBinary(),this.getUploader().getAcceptedFileTypes())){s()}else{t(new n("FILE_TYPE_NOT_ALLOWED"))}}))}}const ds=e=>new Promise(((s,t)=>{const i=new FileReader;i.readAsArrayBuffer(e);i.onload=()=>{const e=i.result;s(e)};i.onerror=()=>{t(i.error)}}));const bs=e=>{const s=[];for(let t=0;t<e.length;t++){s.push(e.charCodeAt(t)&255)}return s};const ps=(e,s,t)=>{for(let i=t,l=0;l<s.length;){if(e.getUint8(i++)!==s[l++]){return false}}return true};const hs=bs("GIF87a");const us=bs("GIF89a");class vs{getSize(e){return new Promise(((s,t)=>{if(e.size<10){return t(new Error("GIF signature not found."))}const i=e.slice(0,10);ds(i).then((e=>{const i=new DataView(e);if(!ps(i,hs,0)&&!ps(i,us,0)){return t(new Error("GIF signature not found."))}s({width:i.getUint16(6,true),height:i.getUint16(8,true)})})).catch((e=>{t(e)}))}))}}const gs=bs("\x89PNG\r\n\x1a\n");const Ps=bs("IHDR");const Fs=bs("CgBI");class fs{getSize(e){return new Promise(((s,t)=>{if(e.size<40){return t(new Error("PNG signature not found."))}const i=e.slice(0,40);ds(i).then((e=>{const i=new DataView(e);if(!ps(i,gs,0)){return t(new Error("PNG signature not found."))}if(ps(i,Fs,12)){if(ps(i,Ps,28)){s({width:i.getUint32(32),height:i.getUint32(36)})}else{return t(new Error("PNG IHDR not found."))}}else if(ps(i,Ps,12)){s({width:i.getUint32(16),height:i.getUint32(20)})}else{return t(new Error("PNG IHDR not found."))}})).catch((e=>t(e)))}))}}const Ls=16973;class ys{getSize(e){return new Promise(((s,t)=>{if(e.size<26){return t(new Error("BMP signature not found."))}const i=e.slice(0,26);ds(i).then((e=>{const i=new DataView(e);if(!i.getUint16(0)===Ls){return t(new Error("BMP signature not found."))}s({width:i.getUint32(18,true),height:Math.abs(i.getInt32(22,true))})})).catch((e=>{t(e)}))}))}}const ms=bs("Exif\0\0");class Hs{getSize(e){return new Promise(((s,t)=>{if(e.size<2){return t(new Error("JPEG signature not found."))}ds(e).then((e=>{const i=new DataView(e);if(i.getUint8(0)!==255||i.getUint8(1)!==216){return t(new Error("JPEG signature not found."))}let l=2;let r=-1;for(;;){if(i.byteLength-l<2){return t(new Error("JPEG signature not found."))}if(i.getUint8(l++)!==255){return t(new Error("JPEG signature not found."))}let e=i.getUint8(l++);let a;while(e===255){e=i.getUint8(l++)}if(208<=e&&e<=217||e===1){a=0}else if(192<=e&&e<=254){if(i.byteLength-l<2){return t(new Error("JPEG signature not found."))}a=i.getUint16(l)-2;l+=2}else{return t(new Error("JPEG unknown markers."))}if(e===217||e===218){return t(new Error("JPEG end of the data stream."))}if(e===225&&a>=10&&ps(i,ms,l)){const e=new DataView(i.buffer,l+6,l+a);r=Bs(e)}if(a>=5&&192<=e&&e<=207&&e!==196&&e!==200&&e!==204){if(i.byteLength-l<a){return t(new Error("JPEG size not found."))}let e=i.getUint16(l+3);let o=i.getUint16(l+1);if(r>=5&&r<=8){[e,o]=[o,e]}return s({width:e,height:o,orientation:r})}l+=a}})).catch((e=>{t(e)}))}))}}const Es={BIG_ENDIAN:19789,LITTLE_ENDIAN:18761};const Bs=e=>{const s=e.getUint16(0);const t=s===Es.BIG_ENDIAN;const i=s===Es.LITTLE_ENDIAN;if(t||i){return Os(e,i)}return-1};const Os=(e,s=false)=>{const t=8;const i=e.getUint16(t,s);const l=12;const r=2;for(let a=0;a<i;a++){const i=t+r+a*l;const o=i+l;if(i>e.byteLength){return-1}const n=new DataView(e.buffer,e.byteOffset+i,o-i);const c=n.getUint16(0,s);if(c===274){const e=n.getUint16(2,s);if(e!==3){return-1}const t=n.getUint32(4,s);if(t!==1){return-1}return n.getUint16(8,s)}}};const ws=1380533830;const Ts=1464156752;const Ss=1448097824;const As=1448097868;const Is=1448097880;class Rs{getSize(e){return new Promise(((s,t)=>{if(e.size<16){return t(new Error("WEBP signature not found."))}const i=e.slice(0,30);ds(i).then((e=>{const i=new DataView(e);if(i.getUint32(0)!==ws&&i.getUint32(8)!==Ts){return t(new Error("WEBP signature not found."))}const l=i.getUint32(12);const r=new DataView(e,20,10);if(l===Ss&&r.getUint8(0)!==47){s({width:r.getUint16(6,true)&16383,height:r.getUint16(8,true)&16383});return}else if(l===As&&r.getUint8(0)===47){const e=r.getUint32(1,true);s({width:(e&16383)+1,height:(e>>14&16383)+1});return}else if(l===Is){const e=r.getUint8(0);const t=(e&192)===0;const i=(e&1)===0;if(t&&i){const e=1+(r.getUint8(6)<<16|r.getUint8(5)<<8|r.getUint8(4));const t=1+(r.getUint8(9)<<0|r.getUint8(8)<<8|r.getUint8(7));s({width:e,height:t});return}}t(new Error("WEBP signature not found."))})).catch((e=>{t(e)}))}))}}const Us=new Hs;const Cs={gif:new vs,png:new fs,bmp:new ys,jpg:Us,jpeg:Us,jpe:Us,webp:new Rs};const Ds=e=>{if(e.size===0){return Promise.reject(new Error("Unknown image type."))}const s=O(e.name).toLowerCase();const t=e.type.replace(/^image\//,"");const i=Cs[s]||Cs[t];if(!i){return Promise.reject(new Error("Unknown image type."))}return i.getSize(e)};var Ms=babelHelpers.classPrivateFieldLooseKey("imageMinWidth");var _s=babelHelpers.classPrivateFieldLooseKey("imageMinHeight");var js=babelHelpers.classPrivateFieldLooseKey("imageMaxWidth");var Ns=babelHelpers.classPrivateFieldLooseKey("imageMaxHeight");var zs=babelHelpers.classPrivateFieldLooseKey("ignoreUnknownImageTypes");class Ks extends ss{constructor(e,s={}){super(e);Object.defineProperty(this,Ms,{writable:true,value:1});Object.defineProperty(this,_s,{writable:true,value:1});Object.defineProperty(this,js,{writable:true,value:7e3});Object.defineProperty(this,Ns,{writable:true,value:7e3});Object.defineProperty(this,zs,{writable:true,value:false});const t=l.Extension.getSettings("ui.uploader.core");babelHelpers.classPrivateFieldLooseBase(this,Ms)[Ms]=t.get("imageMinWidth",babelHelpers.classPrivateFieldLooseBase(this,Ms)[Ms]);babelHelpers.classPrivateFieldLooseBase(this,_s)[_s]=t.get("imageMinHeight",babelHelpers.classPrivateFieldLooseBase(this,_s)[_s]);babelHelpers.classPrivateFieldLooseBase(this,js)[js]=t.get("imageMaxWidth",babelHelpers.classPrivateFieldLooseBase(this,js)[js]);babelHelpers.classPrivateFieldLooseBase(this,Ns)[Ns]=t.get("imageMaxHeight",babelHelpers.classPrivateFieldLooseBase(this,Ns)[Ns]);const i=l.Type.isPlainObject(s)?s:{};this.setImageMinWidth(i["imageMinWidth"]);this.setImageMinHeight(i["imageMinHeight"]);this.setImageMaxWidth(i["imageMaxWidth"]);this.setImageMaxHeight(i["imageMaxHeight"]);this.setIgnoreUnknownImageTypes(i["ignoreUnknownImageTypes"])}apply(e){return new Promise(((s,t)=>{if(!e.isImage()){s();return}Ds(e.getBinary()).then((({width:i,height:l})=>{e.setWidth(i);e.setHeight(l);if(i<this.getImageMinWidth()||l<this.getImageMinHeight()){t(new n("IMAGE_IS_TOO_SMALL",{minWidth:this.getImageMinWidth(),minHeight:this.getImageMinHeight()}))}else if(i>this.getImageMaxWidth()||l>this.getImageMaxHeight()){t(new n("IMAGE_IS_TOO_BIG",{maxWidth:this.getImageMaxWidth(),maxHeight:this.getImageMaxHeight()}))}else{s()}})).catch((e=>{if(this.getIgnoreUnknownImageTypes()){s()}else{if(e){console.log("Uploader ImageSizeFilter:",e)}t(new n("IMAGE_TYPE_NOT_SUPPORTED"))}}))}))}getImageMinWidth(){return babelHelpers.classPrivateFieldLooseBase(this,Ms)[Ms]}setImageMinWidth(e){if(l.Type.isNumber(e)&&e>0){babelHelpers.classPrivateFieldLooseBase(this,Ms)[Ms]=e}}getImageMinHeight(){return babelHelpers.classPrivateFieldLooseBase(this,_s)[_s]}setImageMinHeight(e){if(l.Type.isNumber(e)&&e>0){babelHelpers.classPrivateFieldLooseBase(this,_s)[_s]=e}}getImageMaxWidth(){return babelHelpers.classPrivateFieldLooseBase(this,js)[js]}setImageMaxWidth(e){if(l.Type.isNumber(e)&&e>0){babelHelpers.classPrivateFieldLooseBase(this,js)[js]=e}}getImageMaxHeight(){return babelHelpers.classPrivateFieldLooseBase(this,Ns)[Ns]}setImageMaxHeight(e){if(l.Type.isNumber(e)&&e>0){babelHelpers.classPrivateFieldLooseBase(this,Ns)[Ns]=e}}getIgnoreUnknownImageTypes(){return babelHelpers.classPrivateFieldLooseBase(this,zs)[zs]}setIgnoreUnknownImageTypes(e){if(l.Type.isBoolean(e)){babelHelpers.classPrivateFieldLooseBase(this,zs)[zs]=e}}}const xs=e=>{const s=new Blob(["(",e.toString(),")()"],{type:"application/javascript"});const t=URL.createObjectURL(s);const i=new Worker(t);return{post:(e,s,t)=>{const l=f();i.onmessage=e=>{if(e.data.id===l){s(e.data.message)}};i.postMessage({id:l,message:e},t)},terminate:()=>{i.terminate();URL.revokeObjectURL(t)}}};const ks=function(){self.onmessage=e=>{setTimeout((()=>{createImageBitmap(e.data.message.file).then((s=>{var t;self.postMessage({id:e==null?void 0:(t=e.data)==null?void 0:t.id,message:s},[s])})).catch((()=>{self.postMessage({id:e.data.id,message:null},[])}))}),0)}};const Gs=e=>new Promise(((s,t)=>{const i=document.createElement("img");const l=URL.createObjectURL(e);i.src=l;i.onerror=e=>{URL.revokeObjectURL(i.src);t(e)};i.onload=()=>{URL.revokeObjectURL(l);s({width:i.naturalWidth,height:i.naturalHeight,image:i})}}));const Ws=(e,s,t)=>{s=Math.round(s);t=Math.round(t);const i=document.createElement("canvas");i.width=s;i.height=t;const l=i.getContext("2d");l.drawImage(e,0,0,s,t);return i};const Vs=l.Browser.isSafari()?["image/jpeg","image/png"]:["image/jpeg","image/png","image/webp"];const Xs=(e,s="image/jpeg",t="auto")=>{s=Vs.includes(s)?s:"image/jpeg";if(t==="force"){return s}else{return Vs.includes(e.type)?e.type:s}};const $s=e=>e.substr(0,e.lastIndexOf("."))||e;const Js={jpeg:"jpg"};const Ys=(e,s)=>{const t=$s(e);const i=s.split("/")[1];const l=Js[i]||i;return`${t}.${l}`};const Qs=window.HTMLCanvasElement&&window.HTMLCanvasElement.prototype;const qs=window.HTMLCanvasElement&&Qs.toBlob;const Zs=(e,s,t)=>new Promise(((i,l)=>{if(qs){e.toBlob((e=>{i(e)}),s,t)}else{const l=B(e.toDataURL(s,t));i(l)}}));const et=(e,s)=>{const{mode:t="contain",upscale:i=false}=s;let{width:l,height:r}=s;if(!l&&!r){return{targetWidth:0,targetHeight:0,useOriginalSize:true}}if(l===null){l=r}else if(r===null){r=l}if(t!=="force"){const s=l/e.width;const a=r/e.height;let o=1;if(t==="cover"){o=Math.max(s,a)}else if(t==="contain"){o=Math.min(s,a)}if(o>1&&i===false){return{targetWidth:e.width,targetHeight:e.height,useOriginalSize:true}}l=e.width*o;r=e.height*o}return{targetWidth:Math.round(l),targetHeight:Math.round(r),useOriginalSize:false}};let st="createImageBitmap"in window&&typeof ImageBitmap!=="undefined"&&ImageBitmap.prototype&&ImageBitmap.prototype.close;if(st&&l.Browser.isSafari()){const e=navigator.userAgent.toLowerCase();const s=new RegExp("version\\/([0-9.]+)","i");const t=s.exec(e);if(t&&t[1]&&t[1]<"16.4"){st=false}}const tt=(e,s)=>new Promise(((t,i)=>{const r=()=>{Gs(e).then((({image:e})=>{a(e)})).catch((e=>{i(e)}))};const a=r=>{const{targetWidth:a,targetHeight:o,useOriginalSize:n}=et(r,s);if(n){if("close"in r){r.close()}t({preview:e,width:r.width,height:r.height});return}const c=Ws(r,a,o);if("close"in r){r.close()}const{quality:d=.92,mimeType:b,mimeTypeMode:p}=s;const h=Xs(e,b,p);Zs(c,h,d).then((s=>{let i=s;if(l.Type.isFile(e)){const t=Ys(e.name,h);i=m(s,t)}t({preview:i,width:a,height:o})})).catch((e=>{i(e)}))};if(st){const s=xs(ks);s.post({file:e},(e=>{s.terminate();if(e){a(e)}else{r()}}))}else{r()}}));const it=e=>/^video\/[a-z0-9.-]+$/i.test(e.type);const lt=(e,s={width:300,height:3e3},t=10)=>new Promise(((i,r)=>{const a=document.createElement("video");a.setAttribute("src",URL.createObjectURL(e));a.load();l.Event.bind(a,"error",(e=>{r("Error while loading video file",e)}));l.Event.bind(a,"loadedmetadata",(()=>{if(a.duration<t){t=0}a.currentTime=t;l.Event.bind(a,"seeked",(()=>{const e={width:a.videoWidth,height:a.videoHeight};const{targetWidth:t,targetHeight:l}=et(e,s);if(!t||!l){r();return}const o=Ws(a,t,l);const{quality:n=.92,mimeType:c="image/jpeg"}=s;Zs(o,c,n).then((e=>{i({preview:e,width:t,height:l})})).catch((()=>{r()}))}))}))}));var rt=babelHelpers.classPrivateFieldLooseKey("imagePreviewWidth");var at=babelHelpers.classPrivateFieldLooseKey("imagePreviewHeight");var ot=babelHelpers.classPrivateFieldLooseKey("imagePreviewQuality");var nt=babelHelpers.classPrivateFieldLooseKey("imagePreviewMimeType");var ct=babelHelpers.classPrivateFieldLooseKey("imagePreviewMimeTypeMode");var dt=babelHelpers.classPrivateFieldLooseKey("imagePreviewUpscale");var bt=babelHelpers.classPrivateFieldLooseKey("imagePreviewResizeMode");var pt=babelHelpers.classPrivateFieldLooseKey("getResizeImageOptions");class ht extends ss{constructor(e,s={}){super(e);Object.defineProperty(this,pt,{value:ut});Object.defineProperty(this,rt,{writable:true,value:300});Object.defineProperty(this,at,{writable:true,value:300});Object.defineProperty(this,ot,{writable:true,value:.92});Object.defineProperty(this,nt,{writable:true,value:"image/jpeg"});Object.defineProperty(this,ct,{writable:true,value:"auto"});Object.defineProperty(this,dt,{writable:true,value:false});Object.defineProperty(this,bt,{writable:true,value:"contain"});const t=l.Type.isPlainObject(s)?s:{};this.setImagePreviewWidth(t["imagePreviewWidth"]);this.setImagePreviewHeight(t["imagePreviewHeight"]);this.setImagePreviewQuality(t["imagePreviewQuality"]);this.setImagePreviewUpscale(t["imagePreviewUpscale"]);this.setImagePreviewResizeMode(t["imagePreviewResizeMode"]);this.setImagePreviewMimeType(t["imagePreviewMimeType"]);this.setImagePreviewMimeTypeMode(t["imagePreviewMimeTypeMode"])}apply(e){return new Promise(((s,t)=>{if(T(e.getBinary())){tt(e.getBinary(),babelHelpers.classPrivateFieldLooseBase(this,pt)[pt]()).then((({preview:t,width:i,height:l})=>{e.setClientPreview(t,i,l);s()})).catch((e=>{if(e){console.log("Uploader: image resize error",e)}s()}))}else if(it(e.getBinary())&&!l.Browser.isSafari()){lt(e.getBinary(),babelHelpers.classPrivateFieldLooseBase(this,pt)[pt]()).then((({preview:t,width:i,height:l})=>{e.setClientPreview(t,i,l);s()})).catch((e=>{if(e){console.log("Uploader: video preview error",e)}s()}))}else{s()}}))}getImagePreviewWidth(){return babelHelpers.classPrivateFieldLooseBase(this,rt)[rt]}setImagePreviewWidth(e){if(l.Type.isNumber(e)&&e>0){babelHelpers.classPrivateFieldLooseBase(this,rt)[rt]=e}}getImagePreviewHeight(){return babelHelpers.classPrivateFieldLooseBase(this,at)[at]}setImagePreviewHeight(e){if(l.Type.isNumber(e)&&e>0){babelHelpers.classPrivateFieldLooseBase(this,at)[at]=e}}getImagePreviewQuality(){return babelHelpers.classPrivateFieldLooseBase(this,ot)[ot]}setImagePreviewQuality(e){if(l.Type.isNumber(e)&&e>.1&&e<=1){babelHelpers.classPrivateFieldLooseBase(this,ot)[ot]=e}}getImagePreviewUpscale(){return babelHelpers.classPrivateFieldLooseBase(this,dt)[dt]}setImagePreviewUpscale(e){if(l.Type.isBoolean(e)){babelHelpers.classPrivateFieldLooseBase(this,dt)[dt]=e}}getImagePreviewResizeMode(){return babelHelpers.classPrivateFieldLooseBase(this,bt)[bt]}setImagePreviewResizeMode(e){if(["contain","force","cover"].includes(e)){babelHelpers.classPrivateFieldLooseBase(this,bt)[bt]=e}}getImagePreviewMimeType(){return babelHelpers.classPrivateFieldLooseBase(this,nt)[nt]}setImagePreviewMimeType(e){if(["image/jpeg","image/png","image/webp"].includes(e)){babelHelpers.classPrivateFieldLooseBase(this,nt)[nt]=e}}getImagePreviewMimeTypeMode(){return babelHelpers.classPrivateFieldLooseBase(this,ct)[ct]}setImagePreviewMimeTypeMode(e){if(["auto","force"].includes(e)){babelHelpers.classPrivateFieldLooseBase(this,ct)[ct]=e}}}function ut(){return{width:this.getImagePreviewWidth(),height:this.getImagePreviewHeight(),mode:this.getImagePreviewResizeMode(),upscale:this.getImagePreviewUpscale(),quality:this.getImagePreviewQuality(),mimeType:this.getImagePreviewMimeType(),mimeTypeMode:this.getImagePreviewMimeTypeMode()}}var vt=babelHelpers.classPrivateFieldLooseKey("resizeWidth");var gt=babelHelpers.classPrivateFieldLooseKey("resizeHeight");var Pt=babelHelpers.classPrivateFieldLooseKey("resizeMethod");var Ft=babelHelpers.classPrivateFieldLooseKey("resizeMimeType");var ft=babelHelpers.classPrivateFieldLooseKey("resizeMimeTypeMode");var Lt=babelHelpers.classPrivateFieldLooseKey("resizeQuality");class yt extends ss{constructor(e,s={}){super(e);Object.defineProperty(this,vt,{writable:true,value:null});Object.defineProperty(this,gt,{writable:true,value:null});Object.defineProperty(this,Pt,{writable:true,value:"contain"});Object.defineProperty(this,Ft,{writable:true,value:"image/jpeg"});Object.defineProperty(this,ft,{writable:true,value:"auto"});Object.defineProperty(this,Lt,{writable:true,value:.92});const t=l.Type.isPlainObject(s)?s:{};this.setResizeWidth(t["imageResizeWidth"]);this.setResizeHeight(t["imageResizeHeight"]);this.setResizeMode(t["imageResizeMode"]);this.setResizeMimeType(t["imageResizeMimeType"]);this.setResizeMimeTypeMode(t["imageResizeMimeTypeMode"]);this.setResizeQuality(t["imageResizeQuality"])}apply(e){return new Promise(((s,t)=>{if(this.getResizeWidth()===null&&this.getResizeHeight()===null){return s()}if(!T(e.getBinary())){return s()}const i={width:this.getResizeWidth(),height:this.getResizeHeight(),mode:this.getResizeMode(),quality:this.getResizeQuality(),mimeType:this.getResizeMimeType(),mimeTypeMode:this.getResizeMimeTypeMode()};tt(e.getBinary(),i).then((({preview:t,width:i,height:l})=>{e.setWidth(i);e.setHeight(l);e.setFile(t);s()})).catch((e=>{if(e){console.log("image resize error",e)}s()}))}))}getResizeWidth(){return babelHelpers.classPrivateFieldLooseBase(this,vt)[vt]}setResizeWidth(e){if(l.Type.isNumber(e)&&e>0||l.Type.isNull(e)){babelHelpers.classPrivateFieldLooseBase(this,vt)[vt]=e}}getResizeHeight(){return babelHelpers.classPrivateFieldLooseBase(this,gt)[gt]}setResizeHeight(e){if(l.Type.isNumber(e)&&e>0||l.Type.isNull(e)){babelHelpers.classPrivateFieldLooseBase(this,gt)[gt]=e}}getResizeMode(){return babelHelpers.classPrivateFieldLooseBase(this,Pt)[Pt]}setResizeMode(e){if(["contain","force","cover"].includes(e)){babelHelpers.classPrivateFieldLooseBase(this,Pt)[Pt]=e}}getResizeMimeType(){return babelHelpers.classPrivateFieldLooseBase(this,Ft)[Ft]}setResizeMimeType(e){if(["image/jpeg","image/png","image/webp"].includes(e)){babelHelpers.classPrivateFieldLooseBase(this,Ft)[Ft]=e}}getResizeMimeTypeMode(){return babelHelpers.classPrivateFieldLooseBase(this,ft)[ft]}setResizeMimeTypeMode(e){if(["auto","force"].includes(e)){babelHelpers.classPrivateFieldLooseBase(this,ft)[ft]=e}}getResizeQuality(){return babelHelpers.classPrivateFieldLooseBase(this,Lt)[Lt]}setResizeQuality(e){if(l.Type.isNumber(e)&&e>.1&&e<=1){babelHelpers.classPrivateFieldLooseBase(this,Lt)[Lt]=e}}}const mt={STARTED:0,STOPPED:1};const Ht={UPLOAD_START:"onUploadStart",UPLOAD_COMPLETE:"onUploadComplete",ERROR:"onError",MAX_FILE_COUNT_EXCEEDED:"onMaxFileCountExceeded",DESTROY:"onDestroy",BEFORE_BROWSE:"onBeforeBrowse",BEFORE_DROP:"onBeforeDrop",BEFORE_PASTE:"onBeforePaste",FILE_BEFORE_ADD:"File:onBeforeAdd",FILE_ADD_START:"File:onAddStart",FILE_LOAD_START:"File:onLoadStart",FILE_LOAD_PROGRESS:"File:onLoadProgress",FILE_LOAD_COMPLETE:"File:onLoadComplete",FILE_ERROR:"File:onError",FILE_ADD:"File:onAdd",FILE_REMOVE:"File:onRemove",FILE_UPLOAD_START:"File:onUploadStart",FILE_UPLOAD_PROGRESS:"File:onUploadProgress",FILE_UPLOAD_COMPLETE:"File:onUploadComplete",FILE_COMPLETE:"File:onComplete",FILE_STATUS_CHANGE:"File:onStatusChange",FILE_STATE_CHANGE:"File:onStateChange"};const Et={VALIDATION:"validation",PREPARATION:"preparation"};const Bt=e=>new Promise(((s,t)=>{if(!e.items){s(e.files?Array.from(e.files):[]);return}const i=Array.from(e.items).filter((e=>Ot(e))).map((e=>wt(e)));Promise.all(i).then((e=>{const t=[];e.forEach((e=>{t.push.apply(t,e)}));s(t)})).catch(t)}));const Ot=e=>{if("webkitGetAsEntry"in e){const s=e.webkitGetAsEntry();if(s){return s.isFile||s.isDirectory}}return e.kind==="file"};const wt=e=>new Promise(((s,t)=>{if(St(e)){Tt(It(e)).then(s).catch(t);return}s([e.getAsFile()])}));const Tt=e=>new Promise(((s,t)=>{const i=[];let l=0;let r=0;const a=()=>{if(r===0&&l===0){s(i)}};const o=e=>{l++;const s=e.createReader();const n=()=>{s.readEntries((e=>{if(e.length===0){l--;a();return}e.forEach((e=>{if(e.isDirectory){o(e)}else{r++;e.file((e=>{i.push(e);r--;a()}))}}));n()}),t)};n()};o(e)}));const St=e=>At(e)&&(It(e)||{}).isDirectory;const At=e=>"webkitGetAsEntry"in e;const It=e=>e.webkitGetAsEntry();let Rt=null;const Ut=()=>{if(Rt===null){try{const e=new DataTransfer;const s=new File(["hello"],"my.txt");e.items.add(s);const t=document.createElement("input");t.setAttribute("type","file");t.files=e.files;Rt=t.files.length===1}catch(e){Rt=false}}return Rt};const Ct=(e,s)=>{try{const t=new DataTransfer;const i=l.Type.isArray(s)?s:[s];i.forEach((e=>{t.items.add(e)}));e.files=t.files}catch(e){return false}return true};var Dt=babelHelpers.classPrivateFieldLooseKey("files");var Mt=babelHelpers.classPrivateFieldLooseKey("multiple");var _t=babelHelpers.classPrivateFieldLooseKey("autoUpload");var jt=babelHelpers.classPrivateFieldLooseKey("allowReplaceSingle");var Nt=babelHelpers.classPrivateFieldLooseKey("maxParallelUploads");var zt=babelHelpers.classPrivateFieldLooseKey("maxParallelLoads");var Kt=babelHelpers.classPrivateFieldLooseKey("acceptOnlyImages");var xt=babelHelpers.classPrivateFieldLooseKey("acceptedFileTypes");var kt=babelHelpers.classPrivateFieldLooseKey("ignoredFileNames");var Gt=babelHelpers.classPrivateFieldLooseKey("maxFileCount");var Wt=babelHelpers.classPrivateFieldLooseKey("server");var Vt=babelHelpers.classPrivateFieldLooseKey("hiddenFields");var Xt=babelHelpers.classPrivateFieldLooseKey("hiddenFieldsContainer");var $t=babelHelpers.classPrivateFieldLooseKey("hiddenFieldName");var Jt=babelHelpers.classPrivateFieldLooseKey("assignAsFile");var Yt=babelHelpers.classPrivateFieldLooseKey("filters");var Qt=babelHelpers.classPrivateFieldLooseKey("status");var qt=babelHelpers.classPrivateFieldLooseKey("onBeforeUploadHandler");var Zt=babelHelpers.classPrivateFieldLooseKey("onFileStatusChangeHandler");var ei=babelHelpers.classPrivateFieldLooseKey("onFileStateChangeHandler");var si=babelHelpers.classPrivateFieldLooseKey("onInputFileChangeHandler");var ti=babelHelpers.classPrivateFieldLooseKey("onPasteHandler");var ii=babelHelpers.classPrivateFieldLooseKey("onDropHandler");var li=babelHelpers.classPrivateFieldLooseKey("browsingNodes");var ri=babelHelpers.classPrivateFieldLooseKey("dropNodes");var ai=babelHelpers.classPrivateFieldLooseKey("pastingNodes");var oi=babelHelpers.classPrivateFieldLooseKey("setLoadEvents");var ni=babelHelpers.classPrivateFieldLooseKey("setUploadEvents");var ci=babelHelpers.classPrivateFieldLooseKey("setRemoveEvents");var di=babelHelpers.classPrivateFieldLooseKey("handleBeforeUpload");var bi=babelHelpers.classPrivateFieldLooseKey("handleFileStatusChange");var pi=babelHelpers.classPrivateFieldLooseKey("handleFileStateChange");var hi=babelHelpers.classPrivateFieldLooseKey("exceedsMaxFileCount");var ui=babelHelpers.classPrivateFieldLooseKey("applyFilters");var vi=babelHelpers.classPrivateFieldLooseKey("removeFile");var gi=babelHelpers.classPrivateFieldLooseKey("handleBrowseClick");var Pi=babelHelpers.classPrivateFieldLooseKey("handleInputFileChange");var Fi=babelHelpers.classPrivateFieldLooseKey("handleDrop");var fi=babelHelpers.classPrivateFieldLooseKey("preventDefault");var Li=babelHelpers.classPrivateFieldLooseKey("handlePaste");var yi=babelHelpers.classPrivateFieldLooseKey("uploadNext");var mi=babelHelpers.classPrivateFieldLooseKey("loadNext");var Hi=babelHelpers.classPrivateFieldLooseKey("setHiddenField");var Ei=babelHelpers.classPrivateFieldLooseKey("resetHiddenField");var Bi=babelHelpers.classPrivateFieldLooseKey("resetHiddenFields");var Oi=babelHelpers.classPrivateFieldLooseKey("syncInputPositions");class wi extends s.EventEmitter{constructor(e){super();Object.defineProperty(this,Oi,{value:Xi});Object.defineProperty(this,Bi,{value:Vi});Object.defineProperty(this,Ei,{value:Wi});Object.defineProperty(this,Hi,{value:Gi});Object.defineProperty(this,mi,{value:ki});Object.defineProperty(this,yi,{value:xi});Object.defineProperty(this,Li,{value:Ki});Object.defineProperty(this,fi,{value:zi});Object.defineProperty(this,Fi,{value:Ni});Object.defineProperty(this,Pi,{value:ji});Object.defineProperty(this,gi,{value:_i});Object.defineProperty(this,vi,{value:Mi});Object.defineProperty(this,ui,{value:Di});Object.defineProperty(this,hi,{value:Ci});Object.defineProperty(this,pi,{value:Ui});Object.defineProperty(this,bi,{value:Ri});Object.defineProperty(this,di,{value:Ii});Object.defineProperty(this,ci,{value:Ai});Object.defineProperty(this,ni,{value:Si});Object.defineProperty(this,oi,{value:Ti});Object.defineProperty(this,Dt,{writable:true,value:[]});Object.defineProperty(this,Mt,{writable:true,value:false});Object.defineProperty(this,_t,{writable:true,value:true});Object.defineProperty(this,jt,{writable:true,value:true});Object.defineProperty(this,Nt,{writable:true,value:2});Object.defineProperty(this,zt,{writable:true,value:10});Object.defineProperty(this,Kt,{writable:true,value:false});Object.defineProperty(this,xt,{writable:true,value:[]});Object.defineProperty(this,kt,{writable:true,value:[".ds_store","thumbs.db","desktop.ini"]});Object.defineProperty(this,Gt,{writable:true,value:null});Object.defineProperty(this,Wt,{writable:true,value:null});Object.defineProperty(this,Vt,{writable:true,value:new Map});Object.defineProperty(this,Xt,{writable:true,value:null});Object.defineProperty(this,$t,{writable:true,value:"file"});Object.defineProperty(this,Jt,{writable:true,value:false});Object.defineProperty(this,Yt,{writable:true,value:new Map});Object.defineProperty(this,Qt,{writable:true,value:mt.STOPPED});Object.defineProperty(this,qt,{writable:true,value:null});Object.defineProperty(this,Zt,{writable:true,value:null});Object.defineProperty(this,ei,{writable:true,value:null});Object.defineProperty(this,si,{writable:true,value:null});Object.defineProperty(this,ti,{writable:true,value:null});Object.defineProperty(this,ii,{writable:true,value:null});Object.defineProperty(this,li,{writable:true,value:new Map});Object.defineProperty(this,ri,{writable:true,value:new Set});Object.defineProperty(this,ai,{writable:true,value:new Set});this.setEventNamespace("BX.UI.Uploader");babelHelpers.classPrivateFieldLooseBase(this,qt)[qt]=babelHelpers.classPrivateFieldLooseBase(this,di)[di].bind(this);babelHelpers.classPrivateFieldLooseBase(this,Zt)[Zt]=babelHelpers.classPrivateFieldLooseBase(this,bi)[bi].bind(this);babelHelpers.classPrivateFieldLooseBase(this,ei)[ei]=babelHelpers.classPrivateFieldLooseBase(this,pi)[pi].bind(this);babelHelpers.classPrivateFieldLooseBase(this,si)[si]=babelHelpers.classPrivateFieldLooseBase(this,Pi)[Pi].bind(this);babelHelpers.classPrivateFieldLooseBase(this,ti)[ti]=babelHelpers.classPrivateFieldLooseBase(this,Li)[Li].bind(this);babelHelpers.classPrivateFieldLooseBase(this,ii)[ii]=babelHelpers.classPrivateFieldLooseBase(this,Fi)[Fi].bind(this);const s=l.Type.isPlainObject(e)?Object.assign({},e):{};babelHelpers.classPrivateFieldLooseBase(this,Mt)[Mt]=l.Type.isBoolean(s.multiple)?s.multiple:false;const t=l.Type.isString(s.acceptedFileTypes)||l.Type.isArray(s.acceptedFileTypes)?s.acceptedFileTypes:wi.getGlobalOption("acceptedFileTypes",null);this.setAcceptedFileTypes(t);const i=l.Type.isBoolean(s.acceptOnlyImages)?s.acceptOnlyImages:wi.getGlobalOption("acceptOnlyImages",null);this.setAcceptOnlyImages(i);const r=l.Type.isArray(s.ignoredFileNames)?s.ignoredFileNames:wi.getGlobalOption("ignoredFileNames",null);this.setIgnoredFileNames(r);this.setMaxFileCount(s.maxFileCount);this.setAllowReplaceSingle(s.allowReplaceSingle);this.assignBrowse(s.browseElement);this.assignDropzone(s.dropElement);this.assignPaste(s.pasteElement);this.setHiddenFieldsContainer(s.hiddenFieldsContainer);this.setHiddenFieldName(s.hiddenFieldName);this.setAssignAsFile(s.assignAsFile);this.setAutoUpload(s.autoUpload);this.setMaxParallelUploads(s.maxParallelUploads);this.setMaxParallelLoads(s.maxParallelLoads);let a=l.Type.isPlainObject(s.serverOptions)?s.serverOptions:{};a=Object.assign({},{controller:s.controller,controllerOptions:s.controllerOptions},a);babelHelpers.classPrivateFieldLooseBase(this,Wt)[Wt]=new qe(a);this.subscribeFromOptions(s.events);this.addFilter(Et.VALIDATION,new os(this,s));this.addFilter(Et.VALIDATION,new cs(this,s));this.addFilter(Et.VALIDATION,new Ks(this,s));this.addFilter(Et.VALIDATION,new ht(this,s));this.addFilter(Et.PREPARATION,new yt(this,s));this.addFilters(s.filters);this.addFiles(s.files)}static getGlobalOption(e,s=null){const t=l.Extension.getSettings("ui.uploader.core");return t.get(e,s)}addFiles(e){if(!l.Type.isArrayLike(e)){return}const s=Array.from(e);if(babelHelpers.classPrivateFieldLooseBase(this,hi)[hi](s)){return}s.forEach((e=>{if(l.Type.isArrayFilled(e)){this.addFile(e[0],e[1])}else{this.addFile(e)}}))}addFile(e,t){const i=new re(e,t);if(this.getIgnoredFileNames().includes(i.getName().toLowerCase())){return}if(babelHelpers.classPrivateFieldLooseBase(this,hi)[hi]([i])){return}if(!this.isMultiple()&&this.shouldReplaceSingle()&&babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].length>0){const e=babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt][0];this.removeFile(e)}const l=new s.BaseEvent({data:{file:i}});this.emit(Ht.FILE_BEFORE_ADD,l);if(l.isDefaultPrevented()){return}i.subscribe(o.STATUS_CHANGE,babelHelpers.classPrivateFieldLooseBase(this,Zt)[Zt]);i.subscribe(o.STATE_CHANGE,babelHelpers.classPrivateFieldLooseBase(this,ei)[ei]);babelHelpers.classPrivateFieldLooseBase(this,ni)[ni](i);babelHelpers.classPrivateFieldLooseBase(this,oi)[oi](i);babelHelpers.classPrivateFieldLooseBase(this,ci)[ci](i);if(i.getOrigin()===a.SERVER){i.setLoadController(this.getServer().createLoadController())}else{i.setLoadController(this.getServer().createClientLoadController())}if(i.getOrigin()===a.CLIENT){const e=this.getServer().createUploadController();i.setUploadController(e)}i.setRemoveController(this.getServer().createRemoveController());babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].push(i);i.emit(o.ADD);this.emit(Ht.FILE_ADD_START,{file:i});if(i.getOrigin()===a.SERVER){i.load()}else{babelHelpers.classPrivateFieldLooseBase(this,mi)[mi]()}}start(){if(this.getStatus()!==mt.STARTED&&this.getPendingFileCount()>0){babelHelpers.classPrivateFieldLooseBase(this,Qt)[Qt]=mt.STARTED;this.emit(Ht.UPLOAD_START);babelHelpers.classPrivateFieldLooseBase(this,yi)[yi]()}}cancel(){this.getFiles().forEach((e=>{e.remove()}))}destroy(){this.emit(Ht.DESTROY);this.unassignBrowseAll();this.unassignDropzoneAll();this.unassignPasteAll();this.getFiles().forEach((e=>{e.remove()}));babelHelpers.classPrivateFieldLooseBase(this,Bi)[Bi]();babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt]=[];babelHelpers.classPrivateFieldLooseBase(this,Wt)[Wt]=null;babelHelpers.classPrivateFieldLooseBase(this,xt)[xt]=null;babelHelpers.classPrivateFieldLooseBase(this,kt)[kt]=null;babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt]=null;Object.setPrototypeOf(this,null)}removeFile(e){if(l.Type.isString(e)){e=this.getFile(e)}const s=babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].findIndex((s=>s===e));if(s===-1){return}e.remove()}getFile(e){return babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].find((s=>s.getId()===e))||null}getFiles(){return Array.from(babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt])}isMultiple(){return babelHelpers.classPrivateFieldLooseBase(this,Mt)[Mt]}getStatus(){return babelHelpers.classPrivateFieldLooseBase(this,Qt)[Qt]}addFilter(e,s,t={}){if(l.Type.isFunction(s)||l.Type.isString(s)){const e=l.Type.isString(s)?l.Reflection.getClass(s):s;if(l.Type.isFunction(e)){s=new e(this,t)}}if(s instanceof ss){let t=babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt].get(e);if(!l.Type.isArray(t)){t=[];babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt].set(e,t)}t.push(s)}else{throw new Error("Uploader: a filter must be an instance of FileUploader.Filter.")}}addFilters(e){if(l.Type.isArray(e)){e.forEach((e=>{if(l.Type.isPlainObject(e)){this.addFilter(e.type,e.filter,e.options)}}))}}getServer(){return babelHelpers.classPrivateFieldLooseBase(this,Wt)[Wt]}assignBrowse(e){e=l.Type.isElementNode(e)?[e]:e;if(!l.Type.isArray(e)){return}e.forEach((e=>{if(!l.Type.isElementNode(e)||babelHelpers.classPrivateFieldLooseBase(this,li)[li].has(e)){return}let s;if(e.tagName==="INPUT"&&e.type==="file"){s=e;if(s.files&&s.files.length){this.addFiles(s.files)}const t=s.getAttribute("accept");if(l.Type.isStringFilled(t)){this.setAcceptedFileTypes(t)}babelHelpers.classPrivateFieldLooseBase(this,li)[li].set(e,null)}else{s=document.createElement("input");s.setAttribute("type","file");const t=babelHelpers.classPrivateFieldLooseBase(this,gi)[gi].bind(this,s,e);babelHelpers.classPrivateFieldLooseBase(this,li)[li].set(e,t);l.Event.bind(e,"click",t)}if(this.isMultiple()){s.setAttribute("multiple","multiple")}if(l.Type.isArrayFilled(this.getAcceptedFileTypes())){s.setAttribute("accept",this.getAcceptedFileTypes().join(","))}l.Event.bind(s,"change",babelHelpers.classPrivateFieldLooseBase(this,si)[si])}))}unassignBrowse(e){e=l.Type.isElementNode(e)?[e]:e;if(!l.Type.isArray(e)){return}e.forEach((e=>{if(babelHelpers.classPrivateFieldLooseBase(this,li)[li].has(e)){l.Event.unbind(e,"click",babelHelpers.classPrivateFieldLooseBase(this,li)[li].get(e));l.Event.unbind(e,"change",babelHelpers.classPrivateFieldLooseBase(this,si)[si]);babelHelpers.classPrivateFieldLooseBase(this,li)[li].delete(e)}}))}unassignBrowseAll(){Array.from(babelHelpers.classPrivateFieldLooseBase(this,li)[li].keys()).forEach((e=>{this.unassignBrowse(e)}))}assignDropzone(e){e=l.Type.isElementNode(e)?[e]:e;if(!l.Type.isArray(e)){return}e.forEach((e=>{if(!l.Type.isElementNode(e)||babelHelpers.classPrivateFieldLooseBase(this,ri)[ri].has(e)){return}l.Event.bind(e,"dragover",babelHelpers.classPrivateFieldLooseBase(this,fi)[fi]);l.Event.bind(e,"dragenter",babelHelpers.classPrivateFieldLooseBase(this,fi)[fi]);l.Event.bind(e,"drop",babelHelpers.classPrivateFieldLooseBase(this,ii)[ii]);babelHelpers.classPrivateFieldLooseBase(this,ri)[ri].add(e)}))}unassignDropzone(e){e=l.Type.isElementNode(e)?[e]:e;if(!l.Type.isArray(e)){return}e.forEach((e=>{if(babelHelpers.classPrivateFieldLooseBase(this,ri)[ri].has(e)){l.Event.unbind(e,"dragover",babelHelpers.classPrivateFieldLooseBase(this,fi)[fi]);l.Event.unbind(e,"dragenter",babelHelpers.classPrivateFieldLooseBase(this,fi)[fi]);l.Event.unbind(e,"drop",babelHelpers.classPrivateFieldLooseBase(this,ii)[ii]);babelHelpers.classPrivateFieldLooseBase(this,ri)[ri].delete(e)}}))}unassignDropzoneAll(){Array.from(babelHelpers.classPrivateFieldLooseBase(this,ri)[ri]).forEach((e=>{this.unassignDropzone(e)}))}assignPaste(e){e=l.Type.isElementNode(e)?[e]:e;if(!l.Type.isArray(e)){return}e.forEach((e=>{if(!l.Type.isElementNode(e)||babelHelpers.classPrivateFieldLooseBase(this,ai)[ai].has(e)){return}l.Event.bind(e,"paste",babelHelpers.classPrivateFieldLooseBase(this,ti)[ti]);babelHelpers.classPrivateFieldLooseBase(this,ai)[ai].add(e)}))}unassignPaste(e){e=l.Type.isElementNode(e)?[e]:e;if(!l.Type.isArray(e)){return}e.forEach((e=>{if(babelHelpers.classPrivateFieldLooseBase(this,ai)[ai].has(e)){l.Event.unbind(e,"paste",babelHelpers.classPrivateFieldLooseBase(this,ti)[ti]);babelHelpers.classPrivateFieldLooseBase(this,ai)[ai].delete(e)}}))}unassignPasteAll(){Array.from(babelHelpers.classPrivateFieldLooseBase(this,ai)[ai]).forEach((e=>{this.unassignPaste(e)}))}getHiddenFieldsContainer(){let e=null;if(l.Type.isStringFilled(babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt])){e=document.querySelector(babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt]);if(!l.Type.isElementNode(e)){console.error(`Uploader: a hidden field container was not found (${babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt]}).`)}}else if(l.Type.isElementNode(babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt])){e=babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt]}return e}setHiddenFieldsContainer(e){if(l.Type.isStringFilled(e)||l.Type.isElementNode(e)||l.Type.isNull(e)){babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt]=e}}getHiddenFieldName(){return babelHelpers.classPrivateFieldLooseBase(this,$t)[$t]}setHiddenFieldName(e){if(l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,$t)[$t]=e}}shouldAssignAsFile(){return babelHelpers.classPrivateFieldLooseBase(this,Jt)[Jt]}setAssignAsFile(e){if(l.Type.isBoolean(e)){babelHelpers.classPrivateFieldLooseBase(this,Jt)[Jt]=e}}getTotalSize(){return babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].reduce(((e,s)=>e+s.getSize()),0)}shouldAutoUpload(){return babelHelpers.classPrivateFieldLooseBase(this,_t)[_t]}setAutoUpload(e){if(l.Type.isBoolean(e)){babelHelpers.classPrivateFieldLooseBase(this,_t)[_t]=e}}getMaxParallelUploads(){return babelHelpers.classPrivateFieldLooseBase(this,Nt)[Nt]}setMaxParallelUploads(e){if(l.Type.isNumber(e)&&e>0){babelHelpers.classPrivateFieldLooseBase(this,Nt)[Nt]=e}}getMaxParallelLoads(){return babelHelpers.classPrivateFieldLooseBase(this,zt)[zt]}setMaxParallelLoads(e){if(l.Type.isNumber(e)&&e>0){babelHelpers.classPrivateFieldLooseBase(this,zt)[zt]=e}}getUploadingFileCount(){return babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].filter((e=>e.isUploading())).length}getPendingFileCount(){return babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].filter((e=>e.isReadyToUpload())).length}static getImageExtensions(){return this.getGlobalOption("imageExtensions",[".jpg",".bmp",".jpeg",".jpe",".gif",".png",".webp"])}setAcceptOnlyImages(e){if(l.Type.isBoolean(e)){this.acceptOnlyImages(e)}}acceptOnlyImages(e=true){const s=e?wi.getImageExtensions():[];this.setAcceptedFileTypes(s);babelHelpers.classPrivateFieldLooseBase(this,Kt)[Kt]=e}shouldAcceptOnlyImages(){return babelHelpers.classPrivateFieldLooseBase(this,Kt)[Kt]}getAcceptedFileTypes(){return babelHelpers.classPrivateFieldLooseBase(this,xt)[xt]}setAcceptedFileTypes(e){if(l.Type.isString(e)){e=e.split(",")}if(l.Type.isArray(e)){babelHelpers.classPrivateFieldLooseBase(this,xt)[xt]=[];babelHelpers.classPrivateFieldLooseBase(this,Kt)[Kt]=false;e.forEach((e=>{if(l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,xt)[xt].push(e)}}))}}getIgnoredFileNames(){return babelHelpers.classPrivateFieldLooseBase(this,kt)[kt]}setIgnoredFileNames(e){if(l.Type.isArray(e)){babelHelpers.classPrivateFieldLooseBase(this,kt)[kt]=[];e.forEach((e=>{if(l.Type.isStringFilled(e)){babelHelpers.classPrivateFieldLooseBase(this,kt)[kt].push(e.toLowerCase())}}))}}setMaxFileCount(e){if(l.Type.isNumber(e)&&e>0||e===null){babelHelpers.classPrivateFieldLooseBase(this,Gt)[Gt]=e}}getMaxFileCount(){return babelHelpers.classPrivateFieldLooseBase(this,Gt)[Gt]}setAllowReplaceSingle(e){if(l.Type.isBoolean(e)){babelHelpers.classPrivateFieldLooseBase(this,jt)[jt]=e}}shouldReplaceSingle(){return babelHelpers.classPrivateFieldLooseBase(this,jt)[jt]}}function Ti(e){e.subscribeFromOptions({[o.LOAD_START]:()=>{this.emit(Ht.FILE_LOAD_START,{file:e})},[o.LOAD_PROGRESS]:s=>{const{progress:t}=s.getData();this.emit(Ht.FILE_LOAD_PROGRESS,{file:e,progress:t})},[o.LOAD_ERROR]:s=>{const{error:t}=s.getData();this.emit(Ht.FILE_ERROR,{file:e,error:t});this.emit(Ht.FILE_ADD,{file:e,error:t});babelHelpers.classPrivateFieldLooseBase(this,mi)[mi]()},[o.LOAD_COMPLETE]:()=>{this.emit(Ht.FILE_ADD,{file:e});this.emit(Ht.FILE_LOAD_COMPLETE,{file:e});if(e.getOrigin()===a.SERVER||!e.isUploadable()){this.emit(Ht.FILE_COMPLETE,{file:e});babelHelpers.classPrivateFieldLooseBase(this,Hi)[Hi](e)}else if(e.isUploadable()&&this.shouldAutoUpload()){e.upload()}babelHelpers.classPrivateFieldLooseBase(this,mi)[mi]()},[o.PREPARE_FILE_ASYNC]:e=>{const s=e.getData().file;return babelHelpers.classPrivateFieldLooseBase(this,ui)[ui](Et.VALIDATION,s).then((()=>babelHelpers.classPrivateFieldLooseBase(this,ui)[ui](Et.PREPARATION,s)))}})}function Si(e){e.subscribeFromOptions({[o.BEFORE_UPLOAD]:babelHelpers.classPrivateFieldLooseBase(this,qt)[qt],[o.UPLOAD_START]:()=>{this.emit(Ht.FILE_UPLOAD_START,{file:e})},[o.UPLOAD_PROGRESS]:s=>{const{progress:t}=s.getData();this.emit(Ht.FILE_UPLOAD_PROGRESS,{file:e,progress:t})},[o.UPLOAD_ERROR]:s=>{const{error:t}=s.getData();this.emit(Ht.FILE_ERROR,{file:e,error:t});babelHelpers.classPrivateFieldLooseBase(this,yi)[yi]()},[o.UPLOAD_COMPLETE]:()=>{this.emit(Ht.FILE_UPLOAD_COMPLETE,{file:e});this.emit(Ht.FILE_COMPLETE,{file:e});babelHelpers.classPrivateFieldLooseBase(this,Hi)[Hi](e);babelHelpers.classPrivateFieldLooseBase(this,yi)[yi]()}})}function Ai(e){e.subscribeOnce(o.REMOVE_ERROR,(s=>{const{error:t}=s.getData();this.emit(Ht.FILE_ERROR,{file:e,error:t})}));e.subscribeOnce(o.REMOVE_COMPLETE,(()=>{babelHelpers.classPrivateFieldLooseBase(this,vi)[vi](e)}))}function Ii(e){if(this.getStatus()===mt.STOPPED){e.preventDefault();this.start()}else{if(this.getUploadingFileCount()>=this.getMaxParallelUploads()){e.preventDefault()}}}function Ri(e){const s=e.getTarget();this.emit(Ht.FILE_STATUS_CHANGE,{file:s})}function Ui(e){const s=e.getTarget();const t=e.getData().property;const i=e.getData().value;this.emit(Ht.FILE_STATE_CHANGE,{file:s,property:t,value:i})}function Ci(e){const s=e.length;const t=babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].length;if(!this.isMultiple()&&s>1){return true}let i;if(this.isMultiple()){i=this.getMaxFileCount()}else{i=this.shouldReplaceSingle()?null:1}if(i!==null&&t+s>i){const e=new n("MAX_FILE_COUNT_EXCEEDED",{maxFileCount:i});this.emit(Ht.MAX_FILE_COUNT_EXCEEDED,{error:e});this.emit(Ht.ERROR,{error:e});return true}return false}function Di(e,...s){return new Promise(((t,i)=>{const l=[...babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt].get(e)||[]];if(l.length===0){t();return}const r=l.shift();l.reduce(((e,t)=>e.then((()=>t.apply(...s)))),r.apply(...s)).then((e=>t(e))).catch((e=>i(e)))}))}function Mi(e){const s=babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].findIndex((s=>s===e));if(s!==-1){babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].splice(s,1)}e.unsubscribeAll();this.emit(Ht.FILE_REMOVE,{file:e});babelHelpers.classPrivateFieldLooseBase(this,Ei)[Ei](e)}function _i(e,t){const i=new s.BaseEvent({data:{input:e,node:t}});this.emit(Ht.BEFORE_BROWSE,i);if(i.isDefaultPrevented()){return}e.click()}function ji(e){const s=e.currentTarget;this.addFiles(Array.from(s.files));s.value=""}function Ni(e){e.preventDefault();const t=new s.BaseEvent({data:{dragEvent:e}});this.emit(Ht.BEFORE_DROP,t);if(t.isDefaultPrevented()){return}Bt(e.dataTransfer).then((e=>{this.addFiles(e)}))}function zi(e){e.preventDefault()}function Ki(e){e.preventDefault();const t=e.clipboardData;if(!t){return}const i=new s.BaseEvent({data:{clipboardEvent:e}});this.emit(Ht.BEFORE_PASTE,i);if(i.isDefaultPrevented()){return}Bt(t).then((e=>{this.addFiles(e)}))}function xi(){if(this.getStatus()!==mt.STARTED){return}const e=this.getMaxParallelUploads();const s=this.getUploadingFileCount();const t=babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].filter((e=>e.isReadyToUpload()));const i=t.length;if(s<e){const i=Math.min(e-s,t.length);for(let e=0;e<i;e++){const s=t[e];s.upload()}}if(s===0&&i===0){babelHelpers.classPrivateFieldLooseBase(this,Qt)[Qt]=mt.STOPPED;this.emit(Ht.UPLOAD_COMPLETE)}}function ki(){const e=this.getMaxParallelLoads();const s=babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].filter((e=>e.isLoading())).length;const t=babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt].filter((e=>e.getStatus()===r.ADDED&&e.getOrigin()===a.CLIENT));if(s<e){const i=Math.min(e-s,t.length);for(let e=0;e<i;e++){const s=t[e];s.load()}}}function Gi(e){const s=this.getHiddenFieldsContainer();if(!s||babelHelpers.classPrivateFieldLooseBase(this,Vt)[Vt].has(e.getId())){return}const t=l.Type.isNumber(e.getServerId());if(t){return}const i=e.getOrigin()===a.CLIENT&&!e.isUploadable()&&this.shouldAssignAsFile()&&Ut();const r=document.createElement("input");r.type=i?"file":"hidden";r.name=this.getHiddenFieldName()+(this.isMultiple()?"[]":"");if(i){l.Dom.style(r,{visibility:"hidden",left:0,top:0,width:0,height:0,position:"absolute","pointer-events":"none"});Ct(r,e.getBinary())}else if(e.getServerId()!==null){r.value=e.getServerId()}l.Dom.append(r,s);babelHelpers.classPrivateFieldLooseBase(this,Vt)[Vt].set(e.getId(),r);babelHelpers.classPrivateFieldLooseBase(this,Oi)[Oi]()}function Wi(e){const s=babelHelpers.classPrivateFieldLooseBase(this,Vt)[Vt].get(e.getId());if(s){l.Dom.remove(s);babelHelpers.classPrivateFieldLooseBase(this,Vt)[Vt].delete(e.getId())}}function Vi(){Array.from(babelHelpers.classPrivateFieldLooseBase(this,Vt)[Vt].values()).forEach((e=>{l.Dom.remove(e)}));babelHelpers.classPrivateFieldLooseBase(this,Vt)[Vt]=[]}function Xi(){const e=this.getHiddenFieldsContainer();if(!e){return}this.getFiles().forEach((s=>{const t=babelHelpers.classPrivateFieldLooseBase(this,Vt)[Vt].get(s.getId());if(t){l.Dom.append(t,e)}}))}var $i=babelHelpers.classPrivateFieldLooseKey("uploader");var Ji=babelHelpers.classPrivateFieldLooseKey("items");var Yi=babelHelpers.classPrivateFieldLooseKey("uploaderError");var Qi=babelHelpers.classPrivateFieldLooseKey("getItemsArray");var qi=babelHelpers.classPrivateFieldLooseKey("getItem");var Zi=babelHelpers.classPrivateFieldLooseKey("handleFileAdd");var el=babelHelpers.classPrivateFieldLooseKey("handleFileRemove");var sl=babelHelpers.classPrivateFieldLooseKey("handleFileStateChange");var tl=babelHelpers.classPrivateFieldLooseKey("handleError");var il=babelHelpers.classPrivateFieldLooseKey("handleUploadStart");var ll=babelHelpers.classPrivateFieldLooseKey("handleUploadComplete");class rl extends s.EventEmitter{constructor(e){super();Object.defineProperty(this,ll,{value:hl});Object.defineProperty(this,il,{value:pl});Object.defineProperty(this,tl,{value:bl});Object.defineProperty(this,sl,{value:dl});Object.defineProperty(this,el,{value:cl});Object.defineProperty(this,Zi,{value:nl});Object.defineProperty(this,qi,{value:ol});Object.defineProperty(this,Qi,{value:al});Object.defineProperty(this,$i,{writable:true,value:null});Object.defineProperty(this,Ji,{writable:true,value:null});Object.defineProperty(this,Yi,{writable:true,value:null});this.setEventNamespace("BX.UI.Uploader.Vue.Adapter");babelHelpers.classPrivateFieldLooseBase(this,Ji)[Ji]=i.ref([]);babelHelpers.classPrivateFieldLooseBase(this,Yi)[Yi]=i.shallowRef(null);const s=l.Type.isPlainObject(e)?Object.assign({},e):{};const r=s.events;s.events={"File:onAddStart":babelHelpers.classPrivateFieldLooseBase(this,Zi)[Zi].bind(this),"File:onRemove":babelHelpers.classPrivateFieldLooseBase(this,el)[el].bind(this),"File:onStateChange":babelHelpers.classPrivateFieldLooseBase(this,sl)[sl].bind(this),onError:babelHelpers.classPrivateFieldLooseBase(this,tl)[tl].bind(this),onUploadStart:babelHelpers.classPrivateFieldLooseBase(this,il)[il].bind(this),onUploadComplete:babelHelpers.classPrivateFieldLooseBase(this,ll)[ll].bind(this)};babelHelpers.classPrivateFieldLooseBase(this,$i)[$i]=new t.Uploader(s);babelHelpers.classPrivateFieldLooseBase(this,$i)[$i].subscribeFromOptions(r)}getUploader(){return babelHelpers.classPrivateFieldLooseBase(this,$i)[$i]}getItems(){return babelHelpers.classPrivateFieldLooseBase(this,Ji)[Ji]}getUploaderError(){return babelHelpers.classPrivateFieldLooseBase(this,Yi)[Yi]}}function al(){return babelHelpers.classPrivateFieldLooseBase(this,Ji)[Ji].value}function ol(e){return babelHelpers.classPrivateFieldLooseBase(this,Qi)[Qi]().find((s=>s.id===e))}function nl(e){const{file:s}=e.getData();const t=s.getState();babelHelpers.classPrivateFieldLooseBase(this,Qi)[Qi]().push(t);this.emit("Item:onAdd",{item:t})}function cl(e){const{file:s}=e.getData();const t=babelHelpers.classPrivateFieldLooseBase(this,Qi)[Qi]().findIndex((e=>e.id===s.getId()));if(t>=0){const e=babelHelpers.classPrivateFieldLooseBase(this,Qi)[Qi]().splice(t,1);this.emit("Item:onRemove",{item:e[0]})}}function dl(e){const{file:s}=e.getData();const t=babelHelpers.classPrivateFieldLooseBase(this,qi)[qi](s.getId());if(t){Object.assign(t,s.getState())}}function bl(e){const{error:s}=e.getData();babelHelpers.classPrivateFieldLooseBase(this,Yi)[Yi].value=s.toJSON();this.emit("Uploader:onError",e)}function pl(e){this.emit("Uploader:onUploadStart",e)}function hl(e){this.emit("Uploader:onUploadComplete",e)}var ul=babelHelpers.classPrivateFieldLooseKey("vueAdapter");var vl=babelHelpers.classPrivateFieldLooseKey("uploaderOptions");var gl=babelHelpers.classPrivateFieldLooseKey("widgetOptions");var Pl=babelHelpers.classPrivateFieldLooseKey("vueApp");class Fl extends s.EventEmitter{constructor(e,s={}){super();Object.defineProperty(this,ul,{writable:true,value:null});Object.defineProperty(this,vl,{writable:true,value:null});Object.defineProperty(this,gl,{writable:true,value:{}});Object.defineProperty(this,Pl,{writable:true,value:null});this.setEventNamespace("BX.UI.Uploader.Vue.Widget");babelHelpers.classPrivateFieldLooseBase(this,vl)[vl]=e;babelHelpers.classPrivateFieldLooseBase(this,gl)[gl]=s}getRootComponent(){return null}getAdapter(){if(babelHelpers.classPrivateFieldLooseBase(this,ul)[ul]===null){babelHelpers.classPrivateFieldLooseBase(this,ul)[ul]=new rl(babelHelpers.classPrivateFieldLooseBase(this,vl)[vl])}return babelHelpers.classPrivateFieldLooseBase(this,ul)[ul]}getUploader(){return this.getAdapter().getUploader()}getVueApp(){if(babelHelpers.classPrivateFieldLooseBase(this,Pl)[Pl]!==null){return babelHelpers.classPrivateFieldLooseBase(this,Pl)[Pl]}babelHelpers.classPrivateFieldLooseBase(this,Pl)[Pl]=i.BitrixVue.createApp(this.getRootComponent(),{uploaderOptions:babelHelpers.classPrivateFieldLooseBase(this,vl)[vl],widgetOptions:babelHelpers.classPrivateFieldLooseBase(this,gl)[gl],uploaderAdapter:this.getAdapter()});return babelHelpers.classPrivateFieldLooseBase(this,Pl)[Pl]}renderTo(e){if(l.Type.isDomNode(e)){this.getVueApp().mount(e)}}}const fl={name:"VueUploaderComponent",props:{uploaderOptions:{type:Object},widgetOptions:{type:Object,default:{}},uploaderAdapter:{type:Object,default:null}},data:()=>({items:[],uploaderError:null}),provide(){return{uploader:this.uploader,adapter:this.adapter,widgetOptions:this.widgetOptions}},beforeCreate(){this.adapter=this.uploaderAdapter===null?new rl(this.uploaderOptions):this.uploaderAdapter;this.uploader=this.adapter.getUploader()},created(){this.items=this.adapter.getItems();this.uploaderError=this.adapter.getUploaderError()},unmounted(){this.uploader.destroy()}};const Ll=e=>/^image\/[a-z0-9.-]+$/i.test(e.type);const yl={JPEG:65496,APP1:65505,EXIF:1165519206,TIFF:18761,Orientation:274,Unknown:65280};const ml=(e,s,t=false)=>e.getUint16(s,t);const Hl=(e,s,t=false)=>e.getUint32(s,t);const El=e=>new Promise(((s,t)=>{const i=new FileReader;i.onload=function(e){const t=new DataView(e.target.result);if(ml(t,0)!==yl.JPEG){s(-1);return}const i=t.byteLength;let l=2;while(l<i){const e=ml(t,l);l+=2;if(e===yl.APP1){if(Hl(t,l+=2)!==yl.EXIF){break}const e=ml(t,l+=6)===yl.TIFF;l+=Hl(t,l+4,e);const i=ml(t,l,e);l+=2;for(let r=0;r<i;r++){if(ml(t,l+r*12,e)===yl.Orientation){s(ml(t,l+r*12+8,e));return}}}else if((e&yl.Unknown)!==yl.Unknown){break}else{l+=ml(t,l)}}s(-1)};i.readAsArrayBuffer(e.slice(0,64*1024))}));const Bl=e=>/^image\/jpeg$/i.test(e.type);var Ol=Object.freeze({formatFileSize:S,getFileExtension:O,getFilenameWithoutExtension:$s,getExtensionFromType:L,getJpegOrientation:El,getArrayBuffer:ds,isDataUri:E,isImage:Ll,isResizableImage:T,isJpeg:Bl,getImageSize:Ds,resizeImage:tt,loadImage:Gs,isValidFileType:ns,canAppendFileToForm:Ut,assignFileToInput:Ct,createFileFromBlob:m,createBlobFromDataUri:B,createUniqueId:f,createWorker:xs});e.Uploader=wi;e.UploaderStatus=mt;e.UploaderEvent=Ht;e.FileStatus=r;e.FileOrigin=a;e.FileEvent=o;e.FilterType=Et;e.Helpers=Ol;e.UploaderError=n;e.VueUploaderAdapter=rl;e.VueUploaderWidget=Fl;e.VueUploaderComponent=fl;e.Server=qe})(this.BX.UI.Uploader=this.BX.UI.Uploader||{},BX.Event,BX.UI.Uploader,BX.Vue3,BX);
//# sourceMappingURL=ui.uploader.bundle.map.js